Converting Delimited string to XML message

Hi,
We are trying to convert pipe delimited string into a xml schema using a XSD and BPEL funtion. Consider a scenario in which message has 5 fields with last as 2 optional fields. So the incoming string message can be like "1|2|3" or "1|2|3|4|5". In this case how the XSD should look like, since for each field we have to give "terminatedby" option in the XSD. So the issue is coming for element 3 where the delimiter can be "|" or "eol" (end of line). How to specify that ? Is there any option to use like "optionally terminated by?"
Any help will be appreciated.
Thanks,
Ramesh
Edited by: rameshchandra85 on 2 Aug, 2010 10:00 AM

Hi Ramesh,
You can use below XSD for input file of kind
1|2|3
1|2|3|4|5
1|2|3|4
1|2|3|4|5|6
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
            targetNamespace="http://TargetNamespace.com/InboundService"
            xmlns:tns="http://TargetNamespace.com/InboundService"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified" nxsd:encoding="ASCII" nxsd:stream="chars" nxsd:version="NXSD">
  <xsd:element name="Root-Element">
    <xsd:complexType>
      <xsd:choice minOccurs="1" maxOccurs="unbounded" nxsd:choiceCondition="terminated" nxsd:terminatedBy="|">
        <xsd:element name="RECORD1" nxsd:conditionValue="1">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="RECORD2" nxsd:conditionValue="2">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C5" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="RECORD3" nxsd:conditionValue="3">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="RECORD4" nxsd:conditionValue="4">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C5" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="C6" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:choice>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
<!--NXSDWIZ:D:\DBIN\ReadFile.txt:-->
<!--USE-HEADER:false:-->But in your case if you are getting 5 elements instead of 3 elements in some other file....Use the same and maipulate the last element afterwards.
I think we can not have an element definition for two scenarios.
Update you if i get any..
Regards
PavanKumar.M

Similar Messages

  • How to convert a delimited string to XML?

    Hi there,
    Please help me to convert a pipe delimited string into XML, e.g.
    string -------SubName:abc|SuvValue:123|
    required XML:
    <ROWS>
    <ROW>
    <SubName>abc</SubName>
    <SubValue>123</SubValue>
    </ROW>
    </ROWS>
    or
    string -------abc|123|
    required XML:
    <ROWS>
    <ROW>
    <SubName>abc</SubName>
    <SubValue>123</SubValue>
    </ROW>
    </ROWS>
    -----i am trying to first parse the string into a table type and then using the DBMS_XMLGen.getXML function but unable to get values from table type...
    any prompt response is highly appriciated...
    Regards, Hassan

    Hi Hassan,
    If your version supports it (ie 10gR2 and upwards), you can use XQuery to directly parse the string and generate the XML :
    SQL> SELECT XMLQuery(
      2   '<ROWS>
      3    <ROW> {
      4     for $i in ora:tokenize($str,"\|")
      5     return
      6      if ($i) then element {substring-before($i,":")} {substring-after($i,":")}
      7      else ()
      8   } </ROW>
      9   </ROWS>'
    10   passing sys_xmlgen('SubName:abc|SubValue:123|') as "str"
    11   returning content
    12  ).getClobVal()
    13  FROM dual;
    XMLQUERY('<ROWS><ROW>{FOR$IINO
    <ROWS><ROW><SubName>abc</SubName><SubValue>123</SubValue></ROW></ROWS>
    Each element is built based on its name from the input string.

  • Convertion of String to XML node using Xquery transformation in OSB

    How to convert string to XML node elementusing a built in function using Xquery transformation in OSB?

    check this out - http://www.javamonamour.org/2011/06/fn-beainlinedxml.html
    if in SOA (BPEL & Mediator) you can use oraext:parseXML.
    you should thoroughly analyse where to implement your requirement as some good practices advise to implement more complex logic in SOA and leave OSB to only connect to the services' endpoints.
    Hope this helps,
    A.

  • How to convert a string into xml file

    Hi,
    i have a string . the string contain fully formated xml data. i mean my string like below
    <?xml version="1.0"?>
    <PARTS>
       <TITLE>Computer Parts</TITLE>
       <PART>
          <ITEM>Motherboard</ITEM>
          <MANUFACTURER>ASUS</MANUFACTURER>
          <MODEL>P3B-F</MODEL>
          <COST> 123.00</COST>
       </PART>
       <PART>
    ......................i want to convert it into an xml file
    can u help me?
    thank u

    Thank you Paul Clapham,
    and sorry ..
    i have some other doubt.. regarding xml
    i want to post an XML file from one server(Server_1) to other server.(Server_2)
    To generate an xml file i used DOM in Server_1.
    using xml.transform , StringWriter i converted it into String.
    I post the string to another server and there i will parse it.
    for that i write the code like below in servlet in server_1
    <form name=fn action=http://localhost:8080/server_2/parseXMl.do method=post>
    <input type=hidden name=xmlFile value="+Xmlstring+">
    <input type=submit >is this process is correct?
    Some of the turorial told that use web-services/XML-RPC
    but i new to both..
    I want to complete it using my knowledge only/
    Is it possible to do it?
    Or any other alternative?
    can help me?

  • How to convert Java string into XML one?

    With SAX I can parse an xml file, but I should create xml file by hands.
    Ok, it's simple, but how to encode java string into XML constant
    like "Hello & goodby" into "Hello & goodby" ?
    Is there a standard method for such special xml characters?

    If you are creating your XML "by hand" then just make sure your hands know that you have to do that. It isn't difficult to write a Java method to do it, if "by hand" means "in Java code". Otherwise your XML is not well-formed. And as far as I know there is no package that takes ill-formed XML and fixes it up.

  • Converting text String to XML file data

    need some guidance. I have to create a XML file of a huge Text File.
    I am parsing the text file according to relevance and passing a set of data each element and attribute seperated by "_".
    I need to create to Xml file out this. It has to be current process as I need to keep on adding new elements and attributes.
    e.g.
    Passing this string
    String temp("Name_Age_Birthdate_Birthplace_Place_teleNumber");
    Need to add this to XML of format
    <Directory>
    <Person>
    <Name>
    <Age>
    <Birthdate>.....
    </Person>
    <Person>
    </Person>
    </Directory>
    The problem not all attributes may be present at some time..
    e.g.
    the person's age may be absent some times.. during that time the xml file should look like <Age/>
    I will need to keep on updating Person list concurrently after the file has been created..
    Need Urgent guidance.. I am still New to java
    A guidance code or link is awaited..
    Thanks.. a Lot

    Do you need to stick to the XML support that comes with Java 1.4 or can you use Third-Party stuff? I'm asking, 'cause I think JDOM is much easier to use for a newbie than the build-in XML API ... and it comes with a VERY easy to use class XMLOutputter that creates XML files!
    Take a look at JDOM:
    http://www.jdom.org/

  • How to convert a string-xml placed  inside an xml tag to xml format.

    I have a invoke activity to invoke Web service(code snippet from bpel) .The text in bold is a string that gets formed based on some condition using concat inside while loop .Before calling the WS i need to convert this string into xml
    Any idea how can we do this ?
    <Invoke_A9WS_createObject_InputVariable>
    <part name="parameters">
    <createObject>
    <request>
    <requests>
    <classIdentifier>10141</classIdentifier>
    <data rowId="0">*<number>C0001</number><description>Component from CDM</description>*</data>
    </requests>
    </request>
    </createObject>
    </part>
    </Invoke_A9WS_createObject_InputVariable>
    Request someone to please help .
    Edited by: 869283 on Jul 14, 2011 4:34 AM

    Thanks Dev for your reply ..I have tried using parsEscapedXML but it gives exception
    Fault ID     default/ProjReverseTransform!1.0*soa_6761b853-f458-4b1a-b9c3-6c060cde9350/transform/210018-BpAss3-BpSeq0.3-3
    Fault Time     Jul 15, 2011 1:23:42 PM
    Non Recoverable System Fault :
    <bpelFault><faultType>0</faultType><subLanguageExecutionFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>XPath expression failed to execute. An error occurs while processing the XPath expression; the expression is oraext:parseEscapedXML('&lt;?xml version="1.0"?>&lt;number xmlns:ns2="http://schemas.oracle.com/service/bpel/common&amp;quot;>C0001 &amp;lt;/number>&amp;lt;description xmlns:ns2=&amp;quot;http://schemas.oracle.com/service/bpel/common">Component from CDM &lt;description>'). The XPath expression failed to execute; the reason was: internal xpath error. Check the detailed root cause described in the exception message text and verify that the XPath query is correct. </summary></part><part name="code"><code>XPathExecutionError</code></part></subLanguageExecutionFault></bpelFault>
    I am using the assign activity as below
    <assign name="Assign_BpelVar">
    <copy>
    <from expression="oraext:parseEscapedXML('&lt;?xml version=&quot;1.0&quot;?>&lt;number xmlns:ns2=&quot;http://schemas.oracle.com/service/bpel/common&amp;quot;>C0001 &amp;lt;/number>&amp;lt;description xmlns:ns2=&amp;quot;http://schemas.oracle.com/service/bpel/common&quot;>Component from CDM &lt;description>')"/>
    <to variable="parameterVar"
    query="/ns2:parameters/ns2:item/ns2:value"/>
    </copy>
    </assign>
    I have harcoded the string here so as to check the working othersie this string gets formed inside a while loop and is stored in a variable.
    parameterVar is variable of type
    <variable name="parameterVar" element="ns2:parameters"/>
    XSD for parameterVar
    <?xml version= '1.0' encoding= 'UTF-8' ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schemas.oracle.com/service/bpel/common"
    targetNamespace="http://schemas.oracle.com/service/bpel/common"
    elementFormDefault="qualified">
    <xsd:element name="parameters">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="item" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="name" type="xsd:string"/>
    <xsd:element name="value">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:any minOccurs="0"
    maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>

  • 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

  • String to XML

    Hi everyone,
    i'm just writing a method, that gets a string and a XPath and want writes the string to the specific XPath in my xml document. The problem ist, that the string itself can contain nodes like (e.g. <image> or something else from my dtd, so i got some problems converting the string to xml. Actually i'm trying this:
         public static void setEditFragment(String content, String xPath) throws Exception {
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             DocumentBuilder builder  = factory.newDocumentBuilder();
             Document document = builder.parse("data.xml");
             XPath xpath = XPathFactory.newInstance().newXPath();
             Node node = (Node)xpath.evaluate(xPath, document, XPathConstants.NODE);
             System.out.println(content);
             node.setTextContent(content);
             // Use a XSLT transformer for writing the new XML file
                Transformer transformer = TransformerFactory.newInstance().newTransformer();
                // Set output to IsoLatin1
                transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
             DOMSource        source = new DOMSource( document );
             FileOutputStream os     = new FileOutputStream("tmp.xml");
             StreamResult     result = new StreamResult( os );
             transformer.transform( source, result ); 
         }but of course this will not work and sets up some cryptic signs in mein xml document....
    can anyone give me advice ?
    Thanks !

    Well, if you already have the data XML encoded, then just write them to a file:
    http://java.sun.com/docs/books/tutorial/essential/io/index.html
    Make sure you encode the data with UTF8:
    http://java.sun.com/javase/6/docs/api/java/lang/String.html#getBytes(java.lang.String)
    Write "<?xml version="1.0" encoding="utf-8"?>" before the data!
    Note however, I generally don't recommend to write XML data by hand. Rather use a framework like JAXB.
    -Puce
    Edited by: Puce on May 8, 2008 1:36 PM

  • How to use create-nodeset-from-delimited-string()

    Hi All,
    I am getting the input data as following
    name rollno sub
    Anu 1 Maths|science|social
    and the output should be as follows:
    name rollno sub
    Anu 1 Maths
    Anu 1 Science
    Anu 1 Social
    I need to implememt this by using oraext:create-nodeset-from-delimited-string() in XSLT Pls help me out in resolving this issue
    Regards,
    Anasuya

    can u elaborate the query with ur input xml and output xml for clear understanding instead of
    name rollno sub
    Anu 1 Maths|science|social
    and the output should be as follows:
    name rollno sub
    Anu 1 Maths
    Anu 1 Science
    Anu 1 Social
    check the following links it might help u
    http://www.soabyte.com/2011/01/delimited-string-to-xml-nodeset.html
    Edited by: olety on Nov 2, 2011 2:29 AM

  • From string to XML

    Hi,
    How can i convert a string to XML so i can use it's tags?

    sergei_developer wrote:
    you have to use :
    var x:XML =<info><titel>blaaaaaaat</titel></info>;
    var s:String = x.info.@title;
    That code is incorrect and it won't work. "titel" is not an attribute but a node so you should access it that way and also, the root node ( called "info" ) is considered implicit, which means that you would access the "titel" node this way: var s:String = x.titel;
    Good luck,
    Barni

  • How to convert Mail attachment file Tab Delimited file to XML.

    Hi PI Experts
        I have XI scenario: MAIL  XI SAP (ABAP Proxy), the process is
    1.     XI will receive tab delimited file as attachment in mail.
    2.     XI will convert the tab delimited file into XML, then map to the target structure.
    3.     Target will be posted into ECC through ABAP Proxy.
    Can anyone help me how can I convert the attachment file (i.e. Tab delimited file) to XML while configuring the sender side.
    Thanks in Advance

    I just grabed what I answered from another thread. It should work.
    Processing sequence as follows:
    1. localejbs/AF_Modules/PayloadSwapBean Local Enterprise Bean swap1
    2. localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean tran1
    3. sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail
    Module Configuration as follows: Fill the XXXX part with your info.
    swap1 swap.keyName payload-name
    swap1 swap.keyValue MailAttachment-1
    tran1 Transform.Class com.sap.aii.messaging.adapter.Conversion
    tran1 Transform.ContentType ext/xml;charset=utf-8
    tran1 xml.conversionType SimplePlain2XML
    tran1 xml.documentName XXXXXXX_Mail
    tran1 xml.documentNamespace http://XXXXX.com.au/XXXX
    tran1 xml.fieldSeparator \t
    tran1 xml.processFieldNames fromConfiguration
    tran1 xml.structureTitle rows
    Once you set up the above configuration, you will get one record at a time.
    Create a souce message interface like the followings:
    XXXXXXXXX_Mail
    rows
    record
    Target message interface:
    XXXXXXXXX
    rows
    field 1
    field 2
    field 3
    Write a UDF function to remove the TAB space
    public removeTABSpace(String record,Container container){
    //write your code here
    StringTokenizer st = new StringTokenizer(record,"\t",false);
    String t="";
    while (st.hasMoreElements()) t += st.nextElement();
    return t;
    Write another UDF to get the field 1 for example:
    public String getField1(String input,Container container){
    int counter=0;
    int beginIndex=0;
    int endIndex=0;
    int i;
    for (i=0;i<input.length();i++){
    if (input.charAt(i)==34){
    counter=counter+1;
    if (counter==1){
    beginIndex=i+1;
    counter=0;
    break;
    for (i=0;i<input.length();i++){
    if (input.charAt(i)==34){
    counter=counter+1;
    if (counter==2){
    endIndex=i;
    counter=0;
    break;
    input=input.substring(beginIndex,endIndex);
    return input;
    Get the mapping like the followings:
    record - removeTABSpace - getField1 - field 1
    If you need to get field 2, you will need to write another UDF similar to the above one to handle it.

  • 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 SOAP Message

    Hi,
    I have a problem in conveting a String to SOAPMessage.Can anybody help in suggesting a way. or atleast make me known wether it is possible to do this or not.
    -vyas

    I don't think you can "convert" a String to a SOAP message. If you read the SOAP specification, http://www.www.w3.org/TR/2001/WD-soap12-part1-20011217/, you'll find that you'll have to decide where you want your String to go. If it is xml-formatted, a subelement of the SOAP body element would be a good place for it. If it is not an xml-formatted String, you will have to send it as an attachment.
    Sun's JAX-RPC or JAXM is a good place to start.

  • 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. *

Maybe you are looking for