How to format XML tags in lean manner
Hi,
I have the XML file like unformatted need to format it in ABAP, please suggest me some examples ?
Unformatted:
<?xml version="1.0" encoding="utf-8"?><Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><SchemaVersion>2.0</SchemaVersion><ProjectGuid>{00163e06-2091-1ee4-8399-32cf04305b1f}</ProjectGuid><ProjectType>CopernicusProject</ProjectType><Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration><Name>YCNBE4GCY</Name><RootNamespace>YCNBE4GCY</RootNamespace><RepositoryNamespace>http://463558-one-off.sap.com/YCNBE4GCY_</RepositoryNamespace><RuntimeNamespacePrefix>YCNBE4GCY_</RuntimeNamespacePrefix><RepositoryRootFolder>/YCNBE4GCY_MAIN</RepositoryRootFolder><DefaultProcessComponent>YCNBE4GCY_YCNBE4GCY</DefaultProcessComponent><DevelopmentPackage>$YCNBE4GCY_DEV</DevelopmentPackage><XRepSolution>YCNBE4GCY_MAIN</XRepSolution><BCSourceFolderInXRep>/YCNBE4GCY_BC/SRC</BCSourceFolderInXRep><ProjectSourceFolderinXRep>/YCNBE4GCY_MAIN/SRC</ProjectSourceFolderinXRep><DeploymentUnit>CUSTOMER_RELATIONSHIP_MGMT</DeploymentUnit><CompilerVersion>1302_FP15</CompilerVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' "><OutputPath>bin</OutputPath></PropertyGroup><ItemGroup/><ItemGroup/><ItemGroup/><Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"/></Project>
I want to format it like below :
Formatted:
<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{00163e06-2091-1ee4-8399-32cf04305b1f}</ProjectGuid>
<ProjectType>CopernicusProject</ProjectType>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Name>Y5CMK5NHY</Name>
<RootNamespace>Y5CMK5NHY</RootNamespace>
<RepositoryNamespace>http://463558-one-off.sap.com/Y5CMK5NHY_</RepositoryNamespace>
<RuntimeNamespacePrefix>Y5CMK5NHY_</RuntimeNamespacePrefix>
<RepositoryRootFolder>/Y5CMK5NHY_MAIN</RepositoryRootFolder>
<DefaultProcessComponent>Y5CMK5NHY_Y5CMK5NHY</DefaultProcessComponent>
<DevelopmentPackage>$Y5CMK5NHY_DEV</DevelopmentPackage>
<XRepSolution>Y5CMK5NHY_MAIN</XRepSolution>
<BCSourceFolderInXRep>/Y5CMK5NHY_BC/SRC</BCSourceFolderInXRep>
<ProjectSourceFolderinXRep>/Y5CMK5NHY_MAIN/SRC</ProjectSourceFolderinXRep>
<DeploymentUnit>CUSTOMER_RELATIONSHIP_MGMT</DeploymentUnit>
<CompilerVersion>1302_FP15</CompilerVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"/>
</Project>
Thanks in advance.
Best Regards, Prabhu
Hi.
You can load your XML to cl_ixml .
DATA: ob_ixml TYPE REF TO if_ixml .
DATA: ob_ixml_document TYPE REF TO if_ixml_document ,
Then you can write it to a string I used xstring in this case :
DATA: ob_ixml_stream_factory TYPE REF TO if_ixml_stream_factory.
DATA: ob_ostream TYPE REF TO if_ixml_ostream .
DATA: ob_renderer TYPE REF TO if_ixml_renderer .
DATA: xstring TYPE xstring.
ob_ixml_stream_factory = ob_ixml->create_stream_factory( ).
ob_ostream = ob_ixml_stream_factory->create_ostream_xstring( string = xstring ) .
ob_ostream->set_pretty_print( pretty_print = abap_true ).
ob_renderer = ob_ixml->create_renderer( document = ob_ixml_document ostream = ob_ostream ) .
ob_renderer->render( ).
Note the pretty_print .
Regards.
Similar Messages
-
How to change XML Tag sequence in XML Publisher Reports
Hi Experts,
I am working on XML Publisher reports, EBS 11I and Database 9i. I have standard report 'PO Printed Purchase Order Report (XML)', it's output type is XML. I want to change the sequence of groups in XML file.
I am getting XML tags like below at present:
LIST_G_HEADERS \ G_HEADERS \ LIST_G_HEADER_NOTES
I want to change the sequence of groups like below.
LIST_G_HEADERS \ G_HEADERS \ LIST_G_LINES \
Could somebody help me how to change the sequence of XML Groups.
Thanks in advance.Paul,
This works. Thanks!
I am still working through the implications of having a data connection defined. I notice that every time I submit, it creates two records in my database, one with all the fields blank, and one with the data and attachment.
I will have to do some more digging into the double submission, but at least it is uploading the file.
Thanks again,
Ed -
How to get XML tag attribute vaue in Oracle
Hi,
I have XML file which have order tag
<submitOrderRes>:Application Exception: SOS</submitOrderRes>.
From this xml file i want to display only the tag value , which is 'Application Exception: SOS'.
how to get this tag value by select SQL
any help is appreciate
TYI don't know your query
Here is the example
SQL> l
1 select
2 extractvalue(xmltype(dbms_xmlgen.getxml('select * from emp where rownum=1'))
3 ,'/ROWSET/ROW/ENAME') col_value
4* from dual
SQL> /
COL_VALUE
SMITHSS -
I am trying to format the XML as follows
<empname uom=mil lang=en-us > value of empname </empname>
I have used xmlattribute to try and format the tag, but the nearest I can get is
<empname uom=mil lang=en-us value of empname /> which is well formed, but not what I need.
Am I going down the correct path ?
Thanksimport oracle.xml.parser.v2.*;
import org.w3c.dom.*;
XMLDocument document=new XMLDocument();
Element empname=document.createElement("empname");
document.appenChild(empname);
empname.setAttribute("uom","mil");
empname.setAttribute("lang","en-us");
empname.appendChild(document.createTextNode("value of empname"));thanks,
Deepak -
How to Read XML tags....
Hi guys...
Can any one here tell me how to read the XML tag in PL/SQL.
In table Enquiry there are following fields.
Id number
Status varchar2(5)
Request XML
Reply XML
Error varchar2(10)
Now the following XML will be in request column from the requester.
I have to get the,
->request which is in BODY tag,
->ID number which is in from tag (its the persons unique ID to check his BILL)
Fetch the request from the database and updates it into the REPLY field with the same syntax.
<message>
<to> 123 </to>
<from>789</from>
<body> unbill </body>
<messagenumber> 01 </messagenumber>
</message>
Can any one have the solution to this, how can I read the XML tags, process & again inserts as an XML.
Thanks.Maybe something like this will be a pointer...
SQL> CREATE TABLE t AS
2 select 1 as id, 'C' as status, XMLTYPE('<message><to>123</to><from>789</from><body>unbill</body><messagenumber>01</messagenumber></message>') as request, XMLTYPE('<reply/>') as reply, 'NO ERROR' as error from dual
3 ;
Table created.
SQL>
SQL> SELECT * from t;
ID S
REQUEST
REPLY
ERROR
1 C
<message><to>123</to><from>789</from><body>unbill</body><messagenumber>01</messagenumber></message>
<reply/>
NO ERROR
SQL>
SQL> UPDATE t
2 SET reply = updateXML(request,'/message/body/text()','bill')
3 ;
1 row updated.
SQL>
SQL> SELECT * from t;
ID S
REQUEST
REPLY
ERROR
1 C
<message><to>123</to><from>789</from><body>unbill</body><messagenumber>01</messagenumber></message>
<message><to>123</to><from>789</from><body>bill</body><messagenumber>01</messagenumber></message>
NO ERROR
SQL> -
on release function i am inserting this value
"(&-box*&", "&*box-&
" in to my text box,
in text box will display like this (squarebox), when i am
trying to delete
squarebox ,
box deleting but
(&-box*&", "&*box-&
these xml elements are showing , what i have to
do ? it has to delete,
it amy have multipule box in my equation. how do delete xml
elements in this case, this is my xml code. how to delete? any one
can help me?Then you should provide more details on what you want this new script should do.
To "delete XML tags in already tagged text", all you need is use the "untag" command on an XML Element. But how would the script "know" what XML Element should be untagged?
Disclaimer: This reply is in no way enforceable, legally binding, a promise or contract, an agreement (written, verbal, or otherwise), a commitment, obligation, or free or paid-for offer of any kind to further help, guide, aid, tip, or not hinder you, or contribute to, correct, investigate, comment on or assist with any existing, forthcoming, or planned project. -
How to delete XML Tags in already tagged text?
Hi everyone,
I looked in all the topics but with no results.
Is there anyone that can help me with this script?
Thanks
IvanThen you should provide more details on what you want this new script should do.
To "delete XML tags in already tagged text", all you need is use the "untag" command on an XML Element. But how would the script "know" what XML Element should be untagged?
Disclaimer: This reply is in no way enforceable, legally binding, a promise or contract, an agreement (written, verbal, or otherwise), a commitment, obligation, or free or paid-for offer of any kind to further help, guide, aid, tip, or not hinder you, or contribute to, correct, investigate, comment on or assist with any existing, forthcoming, or planned project. -
How to extract xml tag name contains dashes
Hi, How to parse XML file to extract root tag contains dashes in Flex,for example
XML Input is: <regular-body>Text of my post...</regular-body>
expected output is : regular-body
I appreciate any of your suggestions or inputsDo you want to get the name of the XML ELEMENT regular-body, or the value in the XML file "Text of my post...".
If its the latter, then you could use the bracket/quote notation for extracting the value, like in the following example:
image = xmlWeather[0]..parameters["conditions-icon"]["icon-link"][idx]
I use this when parsing weather information from a 3rd party in which their XML is loaded with dashes.
If you are looking to get the actual element name, not sure how to do that. I would think that if you are using an XML file, you would have at least the high level element known. -
How to pass XML tags in a soapbody parameter having datatype as string?
Hi,
I need to pass XML tags as a String parameter in SOAP:Body.
When I tried send SOAP Request, The SOAP Request was changing < to <
and > to > respectively. Is there any way to ensure that the XML tags (< and >) remain as it is without getting changed.
I also tried to retrieve XML file and stored in a StringBuffer and tried to send SOAP Request but i am still receiving the < and > tags in my SOAP Request.
Pl suggest some alternatives to avoid storing the XML in the form of string and instead directly store the XML into a XML Node so that i can avoid the above condition
Thanks in advance,
gnsinhydHi,
The sample code I used is as follows:
package somepackage;
import javax.mail.internet
import javax.xml.messaging.*;
import javax.xml.soap.*;
import javax.xml.transform.*;
import javax.activation.*;
public class SomeClassName{
// Some namespace declarations
public static void main(String[] args) throws someExceptions{
try
// Create the connection
SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = connectionFactory.createConnection();
// create a new SOAP message using SAAJ API�s
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage request = messageFactory.createMessage();
// Create a SoapAction header
MimeHeaders headers = request.getMimeHeaders();
headers.addHeader("SOAPAction", "soapaction url");
// Object for SOAP Message parts
SOAPPart part = request.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
envelope.addNamespaceDeclaration("xsd","http://www.w3.org/2001/XMLSchema");
envelope.addNamespaceDeclaration("xsi","http://www.w3.org/2001/XMLSchema-instance");
//envelope.addNamespaceDeclaration("enc","http://schemas.xmlsoap.org/soap/encoding/");
envelope.addNamespaceDeclaration("soap","http://schemas.xmlsoap.org/soap/envelop/");
//envelope.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
SOAPBody body = envelope.getBody();
SOAPHeader header = envelope.getHeader();
// Now, build the ClaimStorage element in the body for our request
Name somename = envelope.createName("somename");
// � and configure it with the specifics of our request
SOAPElement ClaimStorage = body.addTextNode("somename");
ClaimStorage.addNamespaceDeclaration("xmlns","url");
ClaimStorage.addChildElement(somename).addTextNode("somename");
ClaimStorage.addChildElement(xmlclaim).addTextNode("<XMLTAGS">); <---THE PROBLEM IS HERE
----> THE XML TAGS < > ARE CHANGING TO < AND > MOST PROBABLY DUE TO POST I THINK.
// Save Message
request.saveChanges();
// View SOAP Request
System.out.println("\n Soap Request:\n");
request.writeTo(System.out);
System.out.println();
// Now, create a connection to the HTTP SOAP endpoint
URLEndpoint endpoint = new URLEndpoint("url.asmx");
// Send request, view response. In a real program, we�d process the response envelope programmatically to see if there was a fault, etc.
System.out.println("request =\n" + request);
SOAPMessage response = connection.call(request, endpoint);
// View the output
System.out.println("\nXML Response\n");
// Create Transformer
TransformerFactory tff = TransformerFactory.newInstance();
Transformer tf = tff.newTransformer();
// Get reply content
Source sc = response.getSOAPPart().getContent();
System.out.println("SOAP Body" + response.getSOAPBody());
// Set output transformation
StreamResult result = new StreamResult(System.out);
tf.transform(sc, result);
System.out.println();
// Close connection
connection.close();
System.out.println("\nResponse =\n" + response);
catch (Exception e)
e.printStackTrace();
Pl. reply as soon as possible
Thanks in advance -
How to set xml tag to nothing in indesign using applescript?
Hi guys,
I need set xml tag to nothing(for tables) in indesign using applescript.
Please help me.Hi,
tell application "Adobe InDesign CC 2014"
tell active document
if (count of story) > 0 then
tell story 1
if (count of tables) > 0 then
tell table 1
set tag_name to associated XML element ----------------> i can't get xml tag, i am receiving the xml tag is nothing.
if (tag_name = nothing) then
display dialog ("This table has no tag")
else
set markup_tag to markup tag of tag_name
set n to name of markup_tag
display dialog ("Tag name is " & n)
end if
end tell
end if
end tell
end if
end tell
end tell
I can't get xml tag for table, i am received nothing -
How to read XML tags in a file, one at a time?
My file format is:
<main>
<section>
(many tags, some including CDATA)
</section>
<section>
(many tags, some including CDATA)
</section>
many more <section>s (over a million)
</main>
To avoid reading all the <section>s into memory, how can I read one <section> at a time?
Thanks in advance.sunmhe wrote:
To avoid reading all the <section>s into memory, how can I read one <section> at a time?If you really want to process huge XML's; you can use SAX or STAX API. -
How to reveal XML tags in InDesign CS5.5?
I'm trying to tag a business catalog for an XML export. I've never done it before - but our sister company has done the same task with a similar catalog. I can view their catalog in InDesign CS5.5 for Windows over a VPN connection in order to see how they tagged their catalog.
I'm doing this task on a Mac using InDesign CS4. The interfaces are not the same. The biggest problem is the sister company is in Czech and so is InDesign. I need to open the tags pane. On the Mac, its just "Window>>Tags." There is a "Window" (Okna) menu, but I'm not seeing a "Tags" choice. I have the structure open, but I want to see all the little colored tags. How do I reveal these on the Windows CS5.5 version?
ThanksWouldn't it be View > Structure > ... ?
-
Oracle9i: Formatting XML Tags
Is there any way to select the XML out of the database and
format ALL the tags?
I seem to be able to format only the top level tag with the use
of sys.xmlgenformatType.createFormat(). Unfortunately, we have
our own set of tags we use so I need to be able to specify ALL
the tags to our format.
Is this possible with any of the 9i XML features?
KristiSomething to that effect yes. I have been using the community ID's and Home Page ID's to keep track of what data for my portlets goes where. Normally this wouldnt be an issue since your data would be differt between the various instances of the portal (dev, test, production) but we have a strange situation currently where we dont have enought rack space to put up all of our servers for the portal. So the only instances we have up is a "sandbox" of types to facilate new tests of code and UI changes, and a "Dev / Production" instance. We are building this Dev instance up with content items and communities and we plan on moving it completely to the Production instances when our servers get racked (as it where). So, I"m concern that data items wont transfer over during the mirgation.Regards,Ray SimpsonSenior Portal DeveloperApollo Group Inc.
-
How to parse XML tag value having '&' character.
Hi,
I have one XML for which value contains '&'. So when I am trying to get the value of that tag from a PL/SQL package its throuwing error as follows:
XML Parse Error: [line 35:col 38] - The reference to entity "SO" must end with the ';' delimiter.
XML :
[b]<LOCCODE>GECORP,Albany1,CP&SO</LOCCODE>
Please let me know how could i handle this '&'.
Thanks
Debashreehint: How is it handeld in html? (check www.w3cschools.com)
-
How to skip XML tags in Simple transformation
Hi,
I am trying to convert an XML file to ABAP code using Simple Transformations.
I tired converting a small XML file to ABAP using it and it worked fine.
The problem is that the number of tags in the XML file I now want to parse is huge (over 200).
Is there any way that for the tag in XML corresponding tag is not created in ST? Is there any conditional tag to achieve this?
Also, is Simple Transformation a better way of parsing in such a scenario over XSLT and DOM parser?
Thanks and Regards,
Neha
Edited by: Neha Anand on Jun 2, 2008 1:19 PMHi Raja,
I have already looked through the code snippets and I am able to write a CALL TRANSFORMATION.
I want to find out if the number of tags is huge then if there is any way that some tags can be skipped for matching tags in XML which anyhow I dont need for manipulation.
Thanks and Regards,
Neha
Maybe you are looking for
-
Hi by mistake i deleted my viber messages how to get them back
Hello i deleted my messages by mistake ...is there any way that i get my messages back thankyou
-
I'm having trouble with downloading music to my iPhone. The music downloads fine but some songs will be missing the last 20-30 seconds. After that time passes the next song will begin to play. Not every song is cut off. I've tried deleting the song
-
I forgot appleid questions and I want to get it back
-
My iphone joins home network, wife's will not
My wife and I recently bought new iPhone 3gs. Mine connects automatically to our secured home network (after I put the name and password into my iPhone). Set my wife's up the same, but her's will not connect to our home network. Under Settings-->Wi-F
-
I configured RAC DB/Application on RHEL4, 10.2.0.1, I want to test Application/DB test , Need suggestions what thing i should test? On Application side and DB side?