Converting string to XML format

Hi All,
I have a requirement to convert string to xml format and download it. Atpresent, I have a string which is a collection of xml tags. I want to convert this string to xml format like <VALUE004>20387899.437</VALUE004>
<VALUE005>20387899.437</VALUE005>
<VALUE006>20387899.437</VALUE006>
Is there any function module for this.

Chk this thread.
Re: Regd: File Conversion to XML format

Similar Messages

  • Converting String To XML Format and send as attachment

    Hi
    My requirement is to convert String into XML Format and that XML File i have to send as an attachment
    can any one one give solution for this Problem.
    Thank you
    Venkatesh.K

    hi,
    i m filling the itab first and converting to xml
    itab contaning these data
    GS_PERSON-CUST_ID   = '3'.
    GS_PERSON-FIRSTNAME = 'Bill'.
    GS_PERSON-LASTNAME  = 'Gates'.
    APPEND GS_PERSON TO GT_PERSON.
    GS_PERSON-CUST_ID   = '4'.
    GS_PERSON-FIRSTNAME = 'Frodo'.
    GS_PERSON-LASTNAME  = 'Baggins'.
    APPEND GS_PERSON TO GT_PERSON.
    after conversion data is coming like that
    #<?xml version="1.0" encoding="utf-16"?>
    <CUSTOMERS>
      <item>
        <customer_id>0003</customer_id>
        <first_name>Bill</first_name>
        <last_name>Gates</last_name>
      </item>
      <item>
        <customer_id>0004</customer_id>
        <first_name>Frodo</first_name>
        <last_name>Baggins</last_name>
      </item>
    </CUSTOMERS>
    but errors are  1) # is coming at the first
                            2)for 'encoding="utf-16"?>', it is not coming perfectly, some other data (iso-8859-1) should come here
    can anybody plz solve it.
    regards,
    viki

  • Convert string into XML inside BPEL

    Hello ,
    How to convert string into xml format ? And make element and define attribute inside it ??

    There are several problems with your input:
    1. Your xml is not well-formed because the attribute values should be enclosed withing double " quotes and not single ' quotes;
    2. You use a prefix (sml) for the folowing part but you dont define the namespace:
    <ids>
    <VID ID="new"/>
    <data>
    <*sml:*attr name="std">
    <sml:value></sml:value>
    </sml:attr>
    <sml:attr name="xde">
    <sml:value></sml:value>
    </sml:attr>
    </data>
    </ids>
    Complete message should be:
    <ids xmlns:sml="somenamespace">
    <VID ID="new"/>
    <data>
    <sml:attr name="std">
    <sml:value></sml:value>
    </sml:attr>
    <sml:attr name="xde">
    <sml:value></sml:value>
    </sml:attr>
    </data>
    </ids>
    3. Do you assign this expression to a variable that is based on the schema of your message you want to parse
    Regards,
    Melvin
    * TIP Answer the question as helpful or correct if it helps you , so that someone else will be knowing that this solution helped you or worked for you and also it gives points to the person who answers the question. *

  • Converting string to xml in xslt

    Hi we are trying to convert string to xml in xslt but it is getting errored out.
    We have followed the procedure mentioned at http://download.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a88894/adx04xsl.htm under the section "How Do I Convert A String to a Nodeset in XSL?".
    Standard procedure mentioned by oracle is not working. Is it a known bug?

    Chk this thread.
    Re: Regd: File Conversion to XML format

  • I want convert string to date format in Oracle

    Dear All
    I want convert string to date format in Oracle,Format is given below
    'Friday, 02 March 2012 2:44 PM' to '02/03/2012 2:44 PM'

    >
    Hi Parwez,
    I want convert string to date format in Oracle,Format is given below
    'Friday, 02 March 2012 2:44 PM' to '02/03/2012 2:44 PM'SELECT TO_DATE('Friday, 02 March 2012 2:44 P.M.', 'DAY, DD MONTH YYYY HH:MI A.M.') from dual;
    As well as what the other poster suggested, look here: http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34924
    HTH,
    Paul...

  • How can I convert IDoc in XML format w/DTD into a string?

    I want to send by e-mail outbound IDoc in XML format with its document type definition (DTD).
    I want to be able to get the same output result into a string than the XML file IDoc port type with DTD activated.  I have created a FM (based on SAP "OWN_FUNCTION") assigned to an IDoc port of type ABAP-PI that executes the following processing steps:
    1-Extract outbound IDoc information to get the sender & recipient mail addresses (EDP13 / EDIPHONE tables).
    2-Convert & Transform IDoc data into XML string using FM IDX_IDOC_TO_XML.
    3-Prepare and send e-mail with XML attachement using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    I cand generate the e-mail with the XML file attachement but FM IDX_IDOC_TO_XML does not convert the IDoc with proper formating and DTD.
    What should I use to accomplish the IDoc conversion to XML w/DTD into a string?
    Should I use XSLT tools ?
    How does that work?
    Thank you
    Carl

    muks wrote:
    Use decimal string to number
    Specifically, you can define a constant with a different datatype on the input on the lower left if you need a different datatype (e.g. U8, I64, DBL, etc) Are all your values integers or do you also need to scan fractional numbers? In this case, you should use "fract/exp string to number" instead.
    LabVIEW Champion . Do more with less code and in less time .

  • Any java experts pls help me in converting attribute to XML formats

    Pls help me oh my god i am a newbie here and i am given this project.
    I had just written a XML doc. which looks like this
    <ConsumerTransfer>
    <TransactionId>
    123:123
    </TransactionId>
    <Billingoption>
    cash
    </Billingoption>
    </ConsumerTransfer>
    I need to make this to attributes like
    private String TransactionId()
    private String BillingOption()
    and so on.....
    I need to convert this attributes to XML format
    can any show me an example or the source codes for this
    Really, I appreciate it.
    JimmyKnot

    For such node level operations I think that DOM would be a good idea. So here you go. Look for some nice tutorial for DOM and you got it.
    salut

  • Converting Javabeans into XML format

    HI,
    I have wrote program that will read input from users then stored them in javabeans. I used the serialize function to create xml file from the javabeans.
    public static void CreateXML(LocationRequest location)
              try
         // Serialize object into XML
         XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
    new FileOutputStream("test.xml")));
         encoder.writeObject(location);
         encoder.close();
         } catch (FileNotFoundException e) {
    The output file is as follows :
    <?xml version="1.0" encoding="UTF-8"?>
    <java version="1.4.1_05" class="java.beans.XMLDecoder">
    <object >
    <void property="address">
    <string>21212122</string>
    </void>
    <void property="originatorId">
    <string>Anu</string>
    </void>
    </object>
    </java>
    Could anyone has idea on how i can change the above xml file into another new xml format like below:-
    <address> 21212122</address>
    <originatorId> "Anu "</originatorId>
    Cheers,
    Bambli

    The quickest way would be to use XSLT. Write a stylesheet that converts your 1st format to your 2nd format.
    Here's an example stylesheet. (I'm a little rusty on my XSL so you'll want to test this.)
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" encoding="UTF-8"/>
      <!-- simply copy the message to the result tree -->
      <xsl:template match="/java/object/void/@property">
        <xsl:element name="local-name()">
          <xsl:value-of select="text()"/>
        </xsl:element>
      </xsl:template>
    </xsl:stylesheet> Feed this to a transformer as follows:
    javax.xml.transform.TranformFacotry factory = javax.xml.transform.TransformerFactory.newInstance();
    javax.xml.transform.stream.StreamSource source = new javax.xml.transform.stream.StreamSource(new java.io.File("yourstylesheet.xsl"));
    javax.xml.transform.Transformer xformer =factory.newTransformer(source);
    xformer.transform(new javax.xml.transform.stream.StreamSource(new java.io.File("yourbean.xml")),new javax.xml.transform.stream.StreamResult(new java.io.File("yourconverted.xml")));Its that simple.
    Cliff

  • Convert PDF to XML Format . Can´t get it working :(

    Hi everybody,
    I am a Rocky in Acrobat Scriptingand I need some helpd to convert a PDF file into an XML format using the build in javascript console.
    The only thing I got so far is:
    this.saveAs("/e/test.xml","com.adobe.acrobat.xml-1-00")
    I got this information from the refrence guide, but I did not find an accurate example. Can you lend me a hand ? If you find a solution can you also explain me the different sections of the code because I still want to learn something besides using the copy and paste option.
    Thank you very much:
    Roland

    Bernd Alheit wrote:
    What happens when you try it?
    The problem is I tried it several times, but nothing happens at all.  The reference guide mentioned a second file with the ending *.xls will be created but nothing happens at all. Can you help me out ?

  • Converting string to XML

    Dear All,
    I am using PI 7.1
    I am trying to invoke a third party SOAP API which accepts request in the form of a string which has embedded xml and also return a string which has xml embedded in it.
    To send the xml as string, I used the feature "Retun as XML" in mapping and it worked fine.
    But the response which has xml embedded, needs to be converted back to XML message.
    I understand that we can write parsers in java, ABAP and also do XSLT mapping.
    Just wanted to know that is there any "out of the box" feature to do the same.
    Please refrain from providing links to java mappings or xslt as I have gone through them already.
    regards,
    Piyush

    Hi Piyush,
                      All parsers will fail to parse the XML message you are getting. Since you are getting the following tag twice within the XMl
    "<?xml version="1.0"?>"
    This tag can be present in an document only once in begining of the document. First you need to remove this tag from appearing in source.
    Suppose you are able to do that then your XML structure will become something like this
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <ns1:AuthenticateResponse xmlns:ns1="urn:Login" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
    <return xsi:type="xsd:string"><MessageResponse sessionid=";jsessionid=FxZLTxtJnXJttpW6gMhJ06kyn00tfSgjt9ZwbzJ55CXGn92S8L6f!-444760742!1311845684753" status="SUCCESS" topicprefix="ND-DSK-117.CXL_HMEL_DB"><Entity name="REF_PERSON"><Property name="last_access_dt" value="20110728145937" type="DATE"/><Property name="modify_person_num" value="21" type="INTEGER"/><Property name="persontopic" value="350523952" type="STRING"/><Property name="login_result_ind" value="0" type="INTEGER"/><Property name="login_result_reason" value="" type="STRING"/><Property name="bypass_drafts" value="0" type="STRING"/><Property name="stl_check_swap_option_pricing_end" value="1" type="BOOLEAN"/><Property name="stl_update_provisional_cashflows" value="0" type="BOOLEAN"/><Property name="stl_autoinvoice_costs" value="1" type="BOOLEAN"/><Property name="stl_allow_payments_from_agents" value="0" type="BOOLEAN"/><Property name="stl_payment_allocation_at_invoice_detail_level" value="1" type="BOOLEAN"/><Property name="last_db_reloaded_on" value="" type="DATE"/><Property name="xl_mode_ind" value="0" type="INTEGER"/><Property name="Xchange_enabled" value="1" type="INTEGER"/><Property name="Xchange_server" value="XCHANGE" type="STRING"/><Property name="ipaddress" value="10.60.4.80" type="STRING"/><Property name="appname" value="CommodityXL" type="STRING"/><Property name="version" value="7.XL7.08.17E" type="STRING"/><Property name="econfirm.server.enabled" value="0" type="BOOLEAN"/></Entity></MessageResponse></return>
    </ns1:AuthenticateResponse>
    Then you can use the following java mapping code to remove the SOAP envelop.
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class RemoveSoapEnvelopSDN implements StreamTransformation{
    public void execute(InputStream in, OutputStream out)
    throws StreamTransformationException {
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         Element root;
         Node p;
         NodeList l;
         int mm,n1;
         //if you need to include namespace use next two lines
         //root=docOut.createElement("ns0:MessageResponse");
         //root.setAttribute("xmlns:ns0","http://connectsystems.be/MAINFR/AccDocument");
         root=docOut.createElement("MessageResponse");
         p=docIn.getElementsByTagName("MessageResponse").item(0);
         l=p.getChildNodes();
         n1=l.getLength();
         for(mm=0;mm<n1;++mm)
              Node temp=docOut.importNode(l.item(mm),true);
              root.appendChild(temp);
         docOut.appendChild(root);
         transform.transform(new DOMSource(docOut), new StreamResult(out));
    catch(Exception e)
         e.printStackTrace();
    public void setParameter(Map arg0) {
    public static void main(String[] args) {
    try{
         RemoveSoapEnvelopSDN genFormat=new RemoveSoapEnvelopSDN();
         FileInputStream in=new FileInputStream("C:\\Apps\\my folder\\sdn\\sdn6.xml");
         FileOutputStream out=new FileOutputStream("C:\\Apps\\my folder\\sdn\\removedEnvelopSdn6.xml");
         genFormat.execute(in,out);
    catch(Exception e)
    e.printStackTrace();
    You can add attributes to the tags as per your requirement. I have commnented those lines in the java code.
    The output will look like this
    http://postimage.org/image/2b2czww90/
    Hope this helps.
    Regards
    Anupam

  • Converting String to datetime format

    I have a String which is in 04-DEC-78 format, I want it to be inserted in to a field in sql database.If I map directly I am getting
    "Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: The input data for the field/parameter "e_date" is invalid according to the expected SqlDbType DateTime. ---> System.FormatException: The string '04-DEC-65' is not a valid
    AllXsd value.
    Tried to convert the string to datetime format in Mapping but getting error
    public DateTime FormatCheck(string param1)
    IFormatProvider culture = new CultureInfo("en-US", true);
    return  DateTime.ParseExact(param1, "dd/MM/yyyy HH:mm:ss.fff", culture);
    Inline Script Error: The type or namespace name 'CultureInfo' could not be found (are you missing a using directive or an assembly reference?) 
    Help me out!!

    HOLD ON!
    Let's try to clear this up. If the input data is "04-DEC-78" then, sorry, none of the code posted so far will work.
    "04-DEC-78" is not directly parsable so the .ParseExact format must match the source.
    The format for xs:datetime is ISO 8601 which is like yyyy-MM-ddTHH:mm:ss-[offset].  Internally the sqlBinding will cast the XsdDateTime (the .Net xs:datetime implementation) to a SqlDateTime.
    One very, very important missing detail is the type of the SQL parameter.  Is it (SQL) datetime or string?
    If the SQL parameter is datetime, then you can use this:
    public string FormatCheck(string param1)
    return DateTime.ParseExact(param1, "dd-MMM-yy", System.Globalization.CultureInfo.InvariantCulture).ToString("s");

  • Error in converting String to XML file

    Hi
    Please see the code below, basically i want to convert the String
    i am having error when parsing xmlFile1, since the xml has some German characters like �
    How do i work around it or what is the best way to do it
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.io.*;
    public class TestXMLFile
         public TestXMLFile() throws Exception
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setValidating(false);
              StringBuffer xmlFile = new StringBuffer();
              xmlFile.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
              xmlFile.append("<ITEMSPECIALNOTES><SPECIALNOTE>unvernderter Nachdruck</SPECIALNOTE></ITEMSPECIALNOTES>");
              ByteArrayInputStream byteArray = new ByteArrayInputStream(xmlFile.toString().getBytes());
            Document doc = factory.newDocumentBuilder().parse(byteArray);
              System.out.println ("String parsed in XML ");     
              StringBuffer xmlFile1 = new StringBuffer();
              xmlFile1.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
              xmlFile1.append("<ITEMSPECIALNOTES><SPECIALNOTE>unver�nderter Nachdruck</SPECIALNOTE></ITEMSPECIALNOTES>");
              ByteArrayInputStream byteArray1 = new ByteArrayInputStream(xmlFile1.toString().getBytes());
            Document doc1 = factory.newDocumentBuilder().parse(byteArray1);
              System.out.println ("String1 parsed in XML ");
         public static void main(String args[])throws Exception
             new TestXMLFile();
    }

    Don't convert to bytes using your system's default encoding but tell the parser that the bytes are encoded in UTF-8.
    In fact since you already have chars, don't convert to bytes and make the parser convert back to chars at all. Do this:String string = xmlFile.toString();
    Document doc =
       factory.newDocumentBuilder().parse(new InputSource(new StringReader(string)));

  • Converting string to xml Document object.

    Hi all,
    I having a string consiste of xml data.
    I wants to convert this to an xml document object.
    When i am trying to do this i am getting fatal error Premature End of file.
    This is sample code from my program.
    String xmlStr = " <TravelItineraryAddInfoRQ>
    <POS>
    <Source PseudoCityCode="A2PB"/>
    </POS>
    </TravelItineraryAddInfoRQ>";
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware( false );
              DocumentBuilder builder = null;
              char[] ch = new char[1200];
    builder = factory.newDocumentBuilder();
    StringReader sr = new StringReader(xmlStr);
    InputSource is = new InputSource(sr);
    Reader r = is.getCharacterStream();
    r.read(ch);
    System.out.println("String Starting ==== ");
    for(int i=0;i<ch.length;i++)
    System.out.print(ch);
    Document XMLDoc = builder.parse(new InputSource(sr));
    System.out.println("Document Object ==== "+XMLDoc);
    thnx,
    raj

    Hi Rajaven,
    use the below step, I think it could help u
    StringBufferInputStream sb = new StringBufferInputStream(strBf));
    doc = db.parse(sb);first conver a string to StringBufferInputStream then parse to doc Object
    hope it will solve.
    let me know if it's not working
    With cheers,
    PrasannA

  • How to convert string to date format?

    Hi All,
    String is in following format: 2006-12-07 i.e yyyy-mm-dd
    I want it in 07.12.2006 date format.
    which function module should i used to convert it?
    Regards,
    Nilima

    an other way to do this :
    Code
    DATA :
    ld_text(20) TYPE c,
    ld_date TYPE datum.
    ld_text = '2006-12-07'.
    REPLACE ALL OCCURENCES OF '-' IN ld_text WITH ''.
    WRITE ld_text TO ld_date.
    WRITE ld_date.

  • Parsing String in XML format

    Hello,
    What is the proper way to parse XML String instead of a XML file?.

    Use new InputSource(new StringReader(s)).
    Good luck.

Maybe you are looking for

  • Rename persistence.xml

    I wrote a utility that will be reused by web-apps and relies on JPA. Those web-apps will likely also rely on JPA. This implies 2 persistence.xml files in the classpath... which can lead to conflicts (and according to posts I read - it does!). So I mu

  • How to do the F1 Documentation

    Hi Experts, I added a field in the screen painter and I want to add some information when the user clicks on F1 on the field just like any other SAP standard fields. How to do this kind of documentation. Please help me out on this, your help will be

  • Gateway Timeout error when running JSP page in 10.1.3 preview

    I am unable to run a JSF JSP page with nothing in it but text. I get an error in the browser: Gateway Timeout The following error occurred: [code=GATEWAY_TIMEOUT] A gateway timeout occurred. The server is unreachable. Retry the request. The url is: h

  • Thumbnails not showing in project

    A certain project suddenly stopped showing the images contained in it. It once did show the thumbnails, but then they disappeared. However, there are images in it somewhere cause if I just go to show all "Photos" I can see the photos in quesiton and

  • Claims advance request .....

    Hi All, We are using ESS 1.0, Webdynpro 600, ECC 6.0 and EP 7.0. Grouping - 40 (India) We are trying to configure spro for mdeical claims re-umbursement. However, there is no node in spro for mentioning workflow id for claims approval. Please shade s