Xmlns in xml

When I used the following code to add an element to existing xml document, there is an additional xmlns attribute, where is it from? what should i do to not include it?
            Node myNode = doc.getElementsByTagName("ABCs").item(0);                       
            Element anElem = doc.createElement("ABC");           
            myNode.appendChild(anElem);generate XML:
<?xml version="1.0" encoding="UTF-8" standalone='yes'?>
<ABCs xmlns="http://xmlns.oracle.com......>
<ABC xmlns=""/>
</ABC>
<ABCs>
{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Hmm..i tried what you have and it worked for me. Here is what i tried
package com.scratch;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
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.xml.sax.InputSource;
public class Scratch {
     private static String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone='yes'?><ABCs xmlns=\"http://xmlns.oracle.com\"></ABCs>";
     private static Document doc = null;
      * @param args
     public static void main(String[] args) {
          try {
               loadXMLFromString(xmlString);
          } catch (Exception e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
          modifyXML();
          String newXML = getStringFromDocument(doc);
          System.err.println(newXML);
      public  static void loadXMLFromString(String xml) throws Exception
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             DocumentBuilder builder = factory.newDocumentBuilder();
             InputSource is = new InputSource(new StringReader(xml));
             doc =  builder.parse(is);
      public static void modifyXML()
           Node myNode = doc.getElementsByTagName("ABCs").item(0);                       
         Element anElem = doc.createElement("ABC");           
         myNode.appendChild(anElem);
      public static String getStringFromDocument(Document doc)
          try
             DOMSource domSource = new DOMSource(doc);
             StringWriter writer = new StringWriter();
             StreamResult result = new StreamResult(writer);
             TransformerFactory tf = TransformerFactory.newInstance();
             Transformer transformer = tf.newTransformer();
             transformer.transform(domSource, result);
             return writer.toString();
          catch(TransformerException ex)
             ex.printStackTrace();
             return null;
}and i got this xml back
<?xml version="1.0" encoding="UTF-8"?><ABCs xmlns="http://xmlns.oracle.com"><ABC/></ABCs>and i am using java se 1.6
Edited by: maheshguruswamy on Feb 27, 2012 11:46 AM

Similar Messages

  • How to remove xmlns from xml using java

    Hi,
    <DLList xmlns="http://www.test.com/integration/feed" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    </DLList>
    The above xml needs to be decomposed using xsu.I am facing a small problem because the xml has namespaces.
    How to remove the namespace using java to get the below xml
    Note:I am using XSLT for the transformation.The XSLT tag is not identifying the <DLList> tag with name space
    <DLList>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    </DLList>
    Please help.Let me know if any other information is required
    Thanks

    OK, here goes :
    For the example, I'll use a TB_DISTRICT table with the following structure :
    create table tb_district (
    sr_no number(3),
    district_name varchar2(100)
    );loaded with data from this page :
    http://india.gov.in/knowindia/districts/andhra1.php?stateid=KA
    and this XML document (one additional record compared to the one you posted) :
    <DLList xmlns="http://www.test.com/integration/feed" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Dharwad</ForecastName>
    <Humidity>70.1</Humidity>
    </Weather>
    </DLList>In order to access the XML, I'll also use this Oracle directory object :
    create directory test_dir as 'D:\ORACLE\test';Final relational tables are :
    create table BUSINESS_TABLE
      STATE         VARCHAR2(30),
      DISTRICT_NAME VARCHAR2(30),
      HUMIDITY      NUMBER
    );and
    create table REJECT_TABLE
      STATE         VARCHAR2(30),
      DISTRICT_NAME VARCHAR2(30),
      HUMIDITY      NUMBER,
      ERROR_MESSAGE VARCHAR2(500)
    );With XMLTable function, we can easily break the XML into relational rows and columns ready to use for DML :
    SQL> alter session set nls_numeric_characters=". ";
    Session altered
    SQL>
    SQL> SELECT *
      2  FROM XMLTable(
      3    XMLNamespaces(default 'http://www.test.com/integration/feed'),
      4    '/DLList/Weather'
      5    passing xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('CHAR_CS'))
      6    columns
      7      state         varchar2(30) path 'StateName'
      8    , district_name varchar2(30) path 'ForecastName'
      9    , humidity      number       path 'Humidity'
    10  )
    11  ;
    STATE                          DISTRICT_NAME                    HUMIDITY
    Karnataka                      Bagalkote                            89.9
    Karnataka                      Devengiri                            89.9
    Karnataka                      Dharwad                              70.1
    Then with a multitable insert, we load both the business table and the reject table (if the district name does not exist in TB_DISTRICT) :
    SQL> INSERT FIRST
      2    WHEN master_district_name IS NOT NULL
      3      THEN INTO business_table (state, district_name, humidity)
      4                VALUES (state, district_name, humidity)
      5    ELSE INTO reject_table (state, district_name, humidity, error_message)
      6              VALUES (state, district_name, humidity, 'Invalid district name')
      7  WITH xml_data AS (
      8    SELECT *
      9    FROM XMLTable(
    10      XMLNamespaces(default 'http://www.test.com/integration/feed'),
    11      '/DLList/Weather'
    12      passing xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('CHAR_CS'))
    13      columns
    14        state         varchar2(30) path 'StateName'
    15      , district_name varchar2(30) path 'ForecastName'
    16      , humidity      number       path 'Humidity'
    17    )
    18  )
    19  SELECT x.*
    20       , t.district_name as master_district_name
    21  FROM xml_data x
    22       LEFT OUTER JOIN tb_district t ON t.district_name = x.district_name
    23  ;
    3 rows inserted
    SQL> select * from business_table;
    STATE                          DISTRICT_NAME                    HUMIDITY
    Karnataka                      Dharwad                              70.1
    SQL> select * from reject_table;
    STATE                          DISTRICT_NAME                    HUMIDITY ERROR_MESSAGE
    Karnataka                      Bagalkote                            89.9 Invalid district name
    Karnataka                      Devengiri                            89.9 Invalid district name

  • Problems sending xml data as string to a web service

    Hello!
    I need to develop a client in order to invoke a web service. I have the WSDL of the web service, so I generate a web service proxy, from that WSDL, using JDeveloper 10.1.3.0.
    Among other things, that web service receive RPC request (binding style is RPC) and the request has only one parameter, which consists of a string. That string must be an XML document (that is, the web service receives one parameter which is a XML document as a String). I generate that parameter, and it looks like the following:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <inputMessage xmlns="http://ws/validacion" xmlns:xsi="http://www.w3.o
    rg/2001/XMLSchema-instance" xsi:SchemaLocation="http://localhost/ws/xsd/mservic/ws.xsd">
    <request>ServiceRequest</request>
    <versionMsg>1.0</versionMsg>
    <data>AAAAAAAAAAAAAA</data>
    </inputMessage>
    However, when I send the request and capture it through HTTPAnalyzer, I get the following:
    <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><MyWebService xmlns="http://soapinterop.org/"><myWebServiceRequest xsi:type="xsd:string" xmlns="">&lt;?xml version = '1.0' encoding = 'UTF-8'?>
    &lt;inputMessage xmlns="http://ws/validacion" xmlns:xsi="http://www.w3.o
    rg/2001/XMLSchema-instance" xsi:SchemaLocation="http://localhost/ws/xsd/mservic/ws.xsd">
    &lt;request>ServiceRequest&lt;/request>
    &lt;versionMsg>1.0&lt;/versionMsg>
    &lt;data>AAAAAAAAAAAAAA&lt;/data>
    &lt;/inputMessage></myWebServiceRequest></MyWebService></soapenv:Body></soapenv:Envelope>
    As you can see, the symbol '<' y replaced with '&lt;'.
    Why does it happen? Is there a way of avoiding that?
    Could anybody be so kind to help me, please?
    Thank you very much in advance.

    Hello!
    I need to develop a client in order to invoke a web
    service. I have the WSDL of the web service, so I
    generate a web service proxy, from that WSDL, using
    JDeveloper 10.1.3.0.
    Among other things, that web service receive RPC
    request (binding style is RPC) and the request has
    only one parameter, which consists of a string. That
    string must be an XML document (that is, the web
    service receives one parameter which is a XML
    document as a String). I generate that parameter, and
    it looks like the following:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <inputMessage xmlns="http://ws/validacion"
    xmlns:xsi="http://www.w3.o
    rg/2001/XMLSchema-instance"
    xsi:SchemaLocation="http://localhost/ws/xsd/mservic/ws
    .xsd">
    <request>ServiceRequest</request>
    <versionMsg>1.0</versionMsg>
    <data>AAAAAAAAAAAAAA</data>
    nputMessage>
    However, when I send the request and capture it
    through HTTPAnalyzer, I get the following:
    <?xml version="1.0"
    encoding="UTF-8"?><soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelop
    e/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body><MyWebService
    xmlns="http://soapinterop.org/"><myWebServiceRequest
    xsi:type="xsd:string" xmlns=""><?xml version =
    '1.0' encoding = 'UTF-8'?>
    <inputMessage xmlns="http://ws/validacion"
    xmlns:xsi="http://www.w3.o
    rg/2001/XMLSchema-instance"
    xsi:SchemaLocation="http://localhost/ws/xsd/mservic/ws
    .xsd">
    <request>ServiceRequest</request>
    <versionMsg>1.0</versionMsg>
    <data>AAAAAAAAAAAAAA</data>
    ;/inputMessage></myWebServiceRequest></MyWebService></
    soapenv:Body></soapenv:Envelope>
    As you can see, the symbol '<' y replaced with
    '<'. (I hope you can see it now)
    The symbol '<' is replace with '& l t ;' (with no whitespaces)
    >
    Why does it happen? Is there a way of avoiding that?
    Could anybody be so kind to help me, please?
    Thank you very much in advance.

  • "Error while parsing SOAP XML payload: no element found" received when invoking Web Service

    Running PB 12.1 Build 7000.  Using Easysoap.  Error ""Error while parsing SOAP XML payload: no element found" received when invoking Web Service".  This error does not appear to be coming from the application code.  Noticed that there were some erroneous characters showing up within the header portion of the XML ("&Quot;").  Not sure where these are coming from.  When I do a find within the PB code for ""&quot;" it gets located within two objects, whereas they both reference a "temp_xml_letter".  Not sure where or what temp_xml_letter resides???   The developer of this is no longer with us and my exposure to WSDL and Web Services is rather limited.  Need to get this resolved...please.
    This is the result of the search.  Notice the extraneous characters ("&quot;"):
    dar1main.pbl(d_as400_mq_xml)
    darlettr.pbl(d_email_xml)
    ---------- Search: Searching Target darwin for 'temp_xml'    (9:52:41 AM)
    ---------- 2 Matches Found On "temp_xml":
    dar1main.pbl(d_as400_mq_xml).d_as400_mq_xml:  export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0  template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> number </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
    darlettr.pbl(d_email_xml).d_email_xml:  export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0  template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> imcnumber </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
    ---------- Done 2 Matches Found On "temp_xml":
    ---------- Finished Searching Target darwin for 'temp_xml'    (9:52:41 AM)

    Maybe "extraneous" is an incorrect term.  Apparantly, based upon the writeup within Wiki, the parser I am using does not interpret the "&quot;"?  How do I find which parser is being utilized and how to control it?
    <<<
    If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
    If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.
    >>>

  • Parsing a XML file using Jdom-Problem.

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    LOL
    This is what you get for working 12 hours straight....
    I changed:
    xmlObject["mydoc"]["modelglue"]["event-handlers"]["event-handler"][i].xmlAttrib utes["name"]<br>
    to:
    #mydoc["modelglue"]["event-handlers"]["event-handler"][i].xmlAttrib utes["name"]#<br>
    xmlObject is the name of my xml object in memory, and then you reference from the root of the xml doc down the chain.
    Sorry for the inconvenience,
    Rich

  • Parsing Xml using Jdom

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

  • Parsing a XML using Jdom --- Problem pls help

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    One suggestion to try:
    Change your code to the following
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    Namespace ns = Namespace.getNamespace(
      "http://schemas.xmlsoap.org/ws/2003/03/business-process/" );
    List list= root.getChildren("partnerLinks", ns );
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());The JavaDoc says for the one-arg getChildren()
    If this target element has no nested elements with the given name outside a namespace, an empty List is returned.
    Your elements have a namespace (the default one) so it should be worth a try.
    Dave Patterson

  • Problem parsing a xml using Jdom

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    One suggestion to try:
    Change your code to the following
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    Namespace ns = Namespace.getNamespace(
      "http://schemas.xmlsoap.org/ws/2003/03/business-process/" );
    List list= root.getChildren("partnerLinks", ns );
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());The JavaDoc says for the one-arg getChildren()
    If this target element has no nested elements with the given name outside a namespace, an empty List is returned.
    Your elements have a namespace (the default one) so it should be worth a try.
    Dave Patterson

  • Intresting problem with JDOM and xmlns in root element.

    Hi all,
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element.Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
              <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
              <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
         </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("file location "));
         Element root = oDoc.getRootElement();
         System.out.println(root.getName());
         String tgtns= root.getAttributeValue("targetNamespace");
         System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
         Iterator it1= list.iterator();
         System.out.println(list.size());
         while(it1.hasNext()){
              Element partnerlinks = (Element)it1.next();
              List list2= partnerlinks.getChildren("partnerLink");
              System.out.println(list2.size());
              Iterator it2= list2.iterator();
              String[][] partnerLinkval = new String [2][list2.size()];
              int i=0,j=0;
              while(it2.hasNext())
                   Element el2= (Element)it2.next();
              String ElementName = el2.getName();
              partnerLinkval[i][j]= ElementName;
              j++;
              String Attribute = el2.getAttributeValue("myRole");
              partnerLinkval[i][j]= Attribute;
              i++;
              j--;
              System.out.println("Saving in array "+el2.getName());
              System.out.println("Saving in array "+Attribute);
              System.out.println("array length"+partnerLinkval.length);
              for (int l=0;l<2;l++){
              for(int k=0;k<partnerLinkval.length;k++)
                   System.out.println(partnerLinkval[l][k]);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file
    process
    tgt ns http://serena.com/buildserviceflow
    1
    2
    Saving in array partnerLink
    Saving in array BpelServiceFlowProvider
    Saving in array partnerLink
    Saving in array null
    array length2
    partnerLink
    BpelServiceFlowProvider
    partnerLink
    null
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    0

    Hi,
    I am also having the same problem using jdom, my code works fine when there is no xmlns attribute but when i put the xmlns attribute back in doesn't work.
    Did you manage to find a way to solve this problem?

  • Question about xml schemas and the use of unqualified nested elements

    Hello,
    I have the following schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://xml.netbeans.org/examples/targetNS"
        targetNamespace="http://xml.netbeans.org/examples/targetNS"
        elementFormDefault="unqualified">
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="age" type="xsd:int"/>
        <xsd:element name="person">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element ref="name"/>
                    <xsd:element ref="age"/>
                   <xsd:element name="height" type="xsd:int"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>I am just wondering why would someone have a nested element that is unqualified? here the "height" element.
    Can anyone explain this to me please?
    Thanks in advance,
    Julien.
    here is an instance xml document
    <?xml version="1.0" encoding="UTF-8"?>
    <person xmlns='http://xml.netbeans.org/examples/targetNS'
      xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
      xsi:schemaLocation='http://xml.netbeans.org/examples/targetNS file:/E:/dev/java/XML/WebApplicationXML/web/newXMLSchemaThree.xsd'>
    <name>toto</name>
    <age>40</age>
    <height>180</height>
    </person>

    Don't worry about it.
    There are two different styles of schemas. In one style, you define the elements, attributes, etc. at the top, and then use the "ref" form to refer to them. (I call this the "global" style.) The other style is to define elements inline where they are used. ("local" style)
    Within some bounds, they work the same and which you use is a choice of you and the tools that generate the schemas.
    A warning about the local style. It is possible to define an element in two different locations in the schema that are different. It will get past all schema validation, but it seems wrong to my sense of esthetics. With the global style, this will not happen.
    So, how did this happen? Probably one person did the schema when it only had a name and age. Then, someone else added the height element. They either used a different tool, or preferred the other style. I'm aware of no difference in the document you have described between the two styles.
    Dave Patterson

  • How do i parse XML tags specific to a particular parent tag ?

    Hi,This the XML i have to parse.
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml version="1.0" encoding="UTF-8"?>
    <Air_MultiAvailabilityReply
         xmlns="http://xml.amadeus.com/SATRSP_07_1_1A">
         <messageActionDetails>
              <functionDetails>
                   <businessFunction>1</businessFunction>
                   <actionCode>45</actionCode>
              </functionDetails>
              <responseType>3</responseType>
         </messageActionDetails>
         <singleCityPairInfo>
              <locationDetails>
                   <origin>BOM</origin>
                   <destination>GOI</destination>
              </locationDetails>
              <cityPairFreeFlowText>
                   <freeTextQualification>
                        <codedIndicator>4</codedIndicator>
                        <typeOfInfo>50</typeOfInfo>
                   </freeTextQualification>
                   <freeText>
                        **-AMADEUS AVAILABILITY - AN ** 164 TH 31DEC 0000
                   </freeText>
              </cityPairFreeFlowText>
              <cityPairFreeFlowText>
                   <freeTextQualification>
                        <codedIndicator>4</codedIndicator>
                        <typeOfInfo>OFD</typeOfInfo>
                   </freeTextQualification>
                   <freeText>GOI GOA.IN</freeText>
              </cityPairFreeFlowText>
              <flightInfo>
                   <basicFlightInfo>
                        <flightDetails>
                             <departureDate>311209</departureDate>
                             <departureTime>0500</departureTime>
                             <arrivalDate>311209</arrivalDate>
                             <arrivalTime>0600</arrivalTime>
                        </flightDetails>
                        <departureLocation>
                             <cityAirport>BOM</cityAirport>
                        </departureLocation>
                        <arrivalLocation>
                             <cityAirport>GOI</cityAirport>
                        </arrivalLocation>
                        <marketingCompany>
                             <identifier>IT</identifier>
                        </marketingCompany>
                        <flightIdentification>
                             <number>3131</number>
                        </flightIdentification>
                        <productTypeDetail>
                             <productIndicators>D</productIndicators>
                             <productIndicators>702</productIndicators>
                             <productIndicators>ET</productIndicators>
                        </productTypeDetail>
                        <lineItemNumber>1</lineItemNumber>
                   </basicFlightInfo>
                   +<infoOnClasses>+
                        <productClassDetail>
                             <serviceClass>Y</serviceClass>
                             <availabilityStatus>9</availabilityStatus>
                        </productClassDetail>
                   </infoOnClasses>
                   <additionalFlightInfo>
                        <flightDetails>
                             <typeOfAircraft>321</typeOfAircraft>
                             <numberOfStops>0</numberOfStops>
                             <legDuration>0100</legDuration>
                        </flightDetails>
                        <departureStation>
                             <terminal>1</terminal>
                        </departureStation>
                        <productFacilities>
                             <type>1A</type>
                        </productFacilities>
                        <productFacilities>
                             <type>DA</type>
                        </productFacilities>
                        <productFacilities>
                             <type>LSA</type>
                        </productFacilities>
                   </additionalFlightInfo>
              </flightInfo>
              <flightInfo>
                   <basicFlightInfo>
                        <flightDetails>
                             <departureDate>311209</departureDate>
                             <departureTime>0520</departureTime>
                             <arrivalDate>311209</arrivalDate>
                             <arrivalTime>0620</arrivalTime>
                        </flightDetails>
                        <departureLocation>
                             <cityAirport>BOM</cityAirport>
                        </departureLocation>
                        <arrivalLocation>
                             <cityAirport>GOI</cityAirport>
                        </arrivalLocation>
                        <marketingCompany>
                             <identifier>IC</identifier>
                        </marketingCompany>
                        <flightIdentification>
                             <number>663</number>
                        </flightIdentification>
                        <productTypeDetail>
                             <productIndicators>D</productIndicators>
                             <productIndicators>ET</productIndicators>
                        </productTypeDetail>
                        <lineItemNumber>2</lineItemNumber>
                   </basicFlightInfo>
                   <infoOnClasses>
                        <productClassDetail>
                             <serviceClass>N</serviceClass>
                             <availabilityStatus>4</availabilityStatus>
                        </productClassDetail>
                   </infoOnClasses>
                   <infoOnClasses>
                        <productClassDetail>
                             <serviceClass>H</serviceClass>
                             <availabilityStatus>4</availabilityStatus>
                        </productClassDetail>
                   </infoOnClasses>
                   <additionalFlightInfo>
                        <flightDetails>
                             <typeOfAircraft>321</typeOfAircraft>
                             <numberOfStops>0</numberOfStops>
                             <legDuration>0100</legDuration>
                        </flightDetails>
                        <departureStation>
                             <terminal>1</terminal>
                        </departureStation>
                        <productFacilities>
                             <type>1A</type>
                        </productFacilities>
                        <productFacilities>
                             <type>DA</type>
                        </productFacilities>
                        <productFacilities>
                             <type>M</type>
                        </productFacilities>
                   </additionalFlightInfo>
              </flightInfo>
         </singleCityPairInfo>
    </Air_MultiAvailabilityReply><flightinfo> is the tag containing information about one airline result.I have created beans containing information about each of the tag referrring to the airline.Now the issue i face is how do i store the information contained in <infoOnClasses> which is specific to each <flightinfo> tag.I have created a bean which has two parameters classtype and number of seats.
    I am using dom for parsing elements.One of my parsing helper method is this :
    private static String getTextValue(Element ele, String tagName) {
              String textVal = null;
              NodeList nl = ele.getElementsByTagName(tagName);
              if(nl != null && nl.getLength() > 0) {
                   Element el = (Element)nl.item(0);
                   textVal = el.getFirstChild().getNodeValue();
              return textVal;
         In the above XML,i have created 2 beans which contains information contained in the 2 <flightinfo> tags and only part missing is how do i create the class information bean specific to each of the <flightinfo> tags.
    Please let me know if any i have missed something.
    Thank you for your consideration.

    punter wrote:
    How do I store the information contained in <infoOnClasses> which is specific to each <flightinfo> tag?Huh? No it isn't. An infoOnClasses element contains a productClassDetail which has a serviceClass and an availabilityStatus. This structure is consistent.
    So where exactly does the "specific to each <flightinfo> tag" come in? Or do you mean that each infoOnClasses belongs to a flightinfo? If so then your flightinfo "bean" would have an attribute which is a List of infoOnClasses beans.
    And you do not, if you can avoid it, hand code XML binders any more... Have a look at XMLBeans (or similar).
    Cheers. Keith.

  • XML-RPC via HTTPService

    I'm trying to make an XML-RPC call via an HTTPService
    instance. Is that the best way to do it?
    At present I can generate a request to the correct URL, but
    the POST seems to be empty. I think that I don't understand what
    should go in the <mx:request> tag -- I have the literal XML
    which I want sent:
    <mx:HTTPService
    id="loginRequest"
    url="
    http://localhost:8080/rpc/xmlrpc"
    useProxy="false"
    method="POST"
    contentType="application/xml"
    resultFormat="e4x" >
    <mx:request xmlns="" format="xml">
    <methodCall>
    <methodName>confluence1.login</methodName>
    <params>
    <param>
    <value><string>{username.text}</string></value>
    </param>
    <param>
    <value><string>{password.text}</string></value>
    </param>
    </params>
    </methodCall>
    </mx:request>
    </mx:HTTPService>
    Thanks for any advice.
    Tom

    I am having a similar problem, when I tried to read the
    contents of the POST in ASP it is blank.
    i'm sending some xml to asp from flex using the httpservice
    but when I try to parse the xml using the standard Microsoft.XMLDOM
    it always fails to parse the xml regardless of what xml I send.
    This leads me to think that flex is sending the xml incorrectly.
    flex code>
    request = new HTTPService();
    request.url="
    http://127.0.0.1/test.asp";
    request.contentType="application/xml"
    request.method="POST"
    request.resultFormat="text"
    request.request = XML(<test>testingxml</test>);
    request.addEventListener(ResultEvent.RESULT, success);
    request.addEventListener(FaultEvent.FAULT, fault);
    request.send();
    private function success(e:mx.rpc.events.ResultEvent):void {
    trace(e.result);
    private function fault(e:mx.rpc.events.FaultEvent):void {
    trace(e.message);
    my ASP code>
    Dim mydoc
    Set mydoc=Server.CreateObject("Microsoft.XMLDOM")
    mydoc.async=false
    mydoc.load(Request)
    Response.ContentType = "text/xml"
    if mydoc.parseError.errorcode<>0 then
    Response.write "<prob name='fail'>blah</prob>"
    else
    Response.write "<prob name='works'>yay</prob>"
    end if
    The asp script always sends <prob
    name='fail'>blah</prob> back to flex meaning that the xml
    failed to parse correctly. The xml is correct, if I load the same
    xml from a text file it will parse correctly, it only fails when
    the xml is loaded from flex.
    Does anyone know the exact format that the xml is sent in
    using the httpservice.send() method? I tried using Request.Form in
    ASP but it only gives the error printed at the bottom of this post.
    BTW is there anyway to get flex to trace error messages given
    from ASP when a script fails as I can't read them in a browser
    (because the request is sent using POST). When ASP gives an error
    flex either does not respond or gives this error which does not
    help my cause.
    (mx.messaging.messages::ErrorMessage)#0
    body = (Object)#1
    clientId = "DirectHTTPChannel0"
    correlationId = "39CFBD08-1AEC-89B8-EECA-57F7BC922158"
    destination = ""
    extendedData = (null)
    faultCode = "Server.Error.Request"
    faultDetail = "Error: [IOErrorEvent type="ioError"
    bubbles=false cancelable=false eventPhase=2 text="Error #2032:
    Stream Error. URL:
    http://127.0.0.1/test.asp"
    URL:
    http://127.0.0.1/test.asp"
    faultString = "HTTP request error"
    headers = (Object)#2
    messageId = "3AC23FB2-BFB0-AC27-AE06-57F7BCC14B44"
    rootCause = (flash.events::IOErrorEvent)#3
    bubbles = false
    cancelable = false
    currentTarget = (flash.net::URLLoader)#4
    bytesLoaded = 0
    bytesTotal = 0
    data = (null)
    dataFormat = "text"
    eventPhase = 2
    target = (flash.net::URLLoader)#4
    text = "Error #2032: Stream Error. URL:
    http://127.0.0.1/test.asp"
    type = "ioError"
    timestamp = 0
    timeToLive = 0
    EDIT:
    I wrote the value of the ASP request (sent from flex) to a
    text file and I ended up getting blank, in other words no XML. Now
    i'm not even sure if flex is sending any xml.

  • Accessing XML Data File

    Ok I need a quick lesson on accessing various tags in a xml
    file and displaying them. I have a rather messy xml file that
    dynamically created and the structure cannot be changed due to an
    Excel application that is already accessing it.
    Here's the xml:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <Files>
    <active>
    <record>
    <sendto>Joe D</sendto>
    <head>
    <level1>
    <submited>true</submited>
    <name>MIKE B</name>
    <str>1</str>
    <date>7/18/2006</date>
    <notes>get this loaded!!!!!!!!!!!!!!!!!</notes>
    </level1>
    <level2>
    <submited>false</submited>
    <name></name>
    <str></str>
    <date></date>
    <notes></notes>
    </level2>
    <level3>
    <submited>false</submited>
    <name></name>
    <str></str>
    <date></date>
    <notes></notes>
    </level3>
    <level4>
    <submited>false</submited>
    <name></name>
    <str></str>
    <date></date>
    <notes></notes>
    </level4>
    </head>
    <itemcd>1234567</itemcd>
    <desc>TEST</desc>
    <retail>5</retail>
    <aisle>AA01</aisle>
    <replcst>2</replcst>
    <pack>1</pack>
    <upc>123456789999</upc>
    <vendor>EMRYW</vendor>
    <venditemcd>1234567</venditemcd>
    <grp>2</grp>
    <sec></sec>
    <insaft></insaft>
    <sellum default="each"></sellum>
    <fracu default="i"></fracu>
    <decp default="0"></decp>
    <allowfr default=" "></allowfr>
    <prium default="each"></prium>
    <selluf default="1.00000"></selluf>
    <priscal default="1"></priscal>
    <stockum default="each"></stockum>
    <itemstyp default="0"></itemstyp>
    <traqoh default="y"></traqoh>
    <rcvum default="each"></rcvum>
    <rcvuf default="1.00000"></rcvuf>
    <rcvscal default="1"></rcvscal>
    <shipum default="each"></shipum>
    <shipuf default="1.00000"></shipuf>
    <stockingstr>
    <str1>true</str1>
    <str2>false</str2>
    <str3>false</str3>
    </stockingstr>
    <pricematlev default="0"></pricematlev>
    <qbreaktable default="0"></qbreaktable>
    <taxflg default="y"></taxflg>
    <gstcd default="0"></gstcd>
    <tradedisf default="n"></tradedisf>
    <promptpayf default="y"></promptpayf>
    <commflg default="y"></commflg>
    <additdescf default="n"></additdescf>
    <talleyitemf default="n"></talleyitemf>
    <nonstkitem default="n"></nonstkitem>
    <assemblyitemf default="n"></assemblyitemf>
    <assemblyitemtype
    default="0"></assemblyitemtype>
    <assemblyledtm default="0"></assemblyledtm>
    <assemblywrkuts default="n/a"></assemblywrkuts>
    <billmattyp default="0"></billmattyp>
    <serialnumf default="n"></serialnumf>
    <bascomitemf default="n"></bascomitemf>
    <bascomitemcd></bascomitemcd>
    <lotctrlf default="n"></lotctrlf>
    <lotctrlnum default="0"></lotctrlnum>
    <relitemmsgnum default="0"></relitemmsgnum>
    <hazmatnum default="0"></hazmatnum>
    <strydf default="s"></strydf>
    <keyitemf default="n"></keyitemf>
    <ctrlitemf default="n"></ctrlitemf>
    <talleyindiv></talleyindiv>
    <textfld2></textfld2>
    <numfld1 default="0"></numfld1>
    <numfld2 default="0"></numfld2>
    <glacctcd default=""></glacctcd>
    <stkitemrptf default="y"></stkitemrptf>
    <lifopolnum default="0"></lifopolnum>
    <lifosampf default="n"></lifosampf>
    <pricetabname default=""></pricetabname>
    <invcstperc default="0.00">
    <str1></str1>
    <str2></str2>
    <str3></str3>
    </invcstperc>
    <invcritfac
    default="0.00"><str1></str1><str2></str2><str3></str3></invcritfac>
    <invglnum
    default="0"><str1></str1><str2></str2><str3></str3></invglnum>
    <invlngrngfac
    default="0.00"><str1></str1><str2></str2><str3></str3></invlngrngfac>
    <invminq default="1">
    <str1></str1>
    <str2></str2>
    <str3></str3>
    </invminq>
    <invmaxq default="2">
    <str1></str1>
    <str2></str2>
    <str3></str3>
    </invmaxq>
    <minmaxtab default="DO_NOT_ORDER">
    <str1></str1>
    <str2></str2>
    <str3></str3>
    </minmaxtab>
    <invmingpperc default="49">
    <str1></str1>
    <str2></str2>
    <str3></str3>
    </invmingpperc>
    <invordq
    default="0"><str1></str1><str2></str2><str3></str3></invordq>
    <price1><str1></str1><str2></str2><str3></str3></price1>
    <price2><str1></str1><str2></str2><str3></str3></price2>
    <price3><str1></str1><str2></str2><str3></str3></price3>
    <price4><str1></str1><str2></str2><str3></str3></price4>
    <price5><str1></str1><str2></str2><str3></str3></price5>
    <price6><str1></str1><str2></str2><str3></str3></price6>
    <price7><str1></str1><str2></str2><str3></str3></price7>
    <price8><str1></str1><str2></str2><str3></str3></price8>
    <aisle default="XXXXX">
    <str1>AA01</str1>
    <str2></str2>
    <str3></str3>
    </aisle>
    <bin><str1></str1><str2></str2><str3></str3></bin>
    <shelf><str1></str1><str2></str2><str3></str3></shelf>
    <invstdcst><str1></str1><str2></str2><str3></str3></invstdcst>
    <manminmax><str1></str1><str2></str2><str3></str3></manminmax>
    <text2><str1></str1><str2></str2><str3></str3></text2>
    <numer1><str1></str1><str2></str2><str3></str3></numer1>
    <numer2><str1></str1><str2></str2><str3></str3></numer2>
    <keyword default=""></keyword>
    <note default="">get this
    loaded!!!!!!!!!!!!!!!!!</note>
    </record>
    </active>
    </Files>
    Here's the code I have so far:
    <?xml version="1.0" encoding="utf-8"?>
    <Application xmlns="
    http://www.adobe.com/2006/mxml"
    layout="absolute" xmlns:local="*">
    <XML id="feedData" source="index.xml"/>
    <DataGrid dataProvider="{feedData..active.record}"
    x="324" y="138" width="500">
    <columns>
    <DataGridColumn id="SubmittedBy" headerText="Submitted
    By" dataField=""/>
    <DataGridColumn headerText="Item" dataField="itemcd"/>
    <DataGridColumn headerText="Description"
    dataField="desc"/>
    </columns>
    </DataGrid>
    </Application>
    What I want to know is how to access and put into the "
    Submitted By" column
    <Files><active><record><head><level1><name>
    Any help would be great since I'm stuck.

    After a little digging and a couple cups of coffee, I managed
    to pull some data extracting from xml into a datagrid. I can access
    attributes, node values, etc...
    One thing I did notice, is that you have to refresh the
    application if you have dynamic data constantly being updated. So
    here is some code to help some of you out:
    First some sample XML (index.xml):
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <records>
    <active name="John" id="1234" location="New York">
    <job>Architect</job>
    <address>111 Salisbury Rd</address>
    </active>
    <inactive name="Chris" id="5432" location="California">
    <job>Web Designer</job>
    <address>888 Orchard Rd</address>
    </inactive>
    </records>
    Code with two tabs one name (
    Active), other named (
    Inactive):
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" xmlns:local="*" pageTitle="Test App"
    creationComplete="srv.send()">
    <mx:HTTPService id="srv" url="
    http://www.domain.com/index.xml?rand=math.random();"
    resultFormat="e4x" useProxy="false" showBusyCursor="true" />
    <mx:XMLListCollection id="xActive"
    source="{srv.lastResult.active}" />
    <mx:XMLListCollection id="xInActive"
    source="{srv.lastResult.inactive}" />
    <mx:script>
    <[[
    private function RefreshData():void{
    xActive.refresh();
    xInActive.refresh();
    ]]>
    </mx:Script>
    <mx:TabNavigator>
    <mx:Canvas label="Active" width="100%" height="100%"
    id="canvas1" initialize="RefreshData();">
    <mx:DataGrid id="activeData" dataProvider="{xActive}"
    selectedIndex="0" editable="true" enabled="true">
    <mx:columns>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="@name" headerText="Name"/>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="@id" headerText="ID"/>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="@location" headerText="Location"/>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="job" headerText="Job"/>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="address" headerText="Address"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Canvas>
    <mx:Canvas label="Inactive" width="100%" height="100%"
    id="canvas2" initialize="RefreshData();">
    <mx:DataGrid id="inactiveData" dataProvider="{xInActive}"
    selectedIndex="0" editable="true" enabled="true">
    <mx:columns>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="@name" headerText="Name"/>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="@id" headerText="ID"/>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="@location" headerText="Location"/>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="job" headerText="Job"/>
    <mx:DataGridColumn textAlign="center" resizable="false"
    dataField="address" headerText="Address"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Canvas>
    </mx:TabNavigator>
    </mx:Application>

  • Org.xml.sax.SAXException error please help me out.............

    hi
    if any one can help me out pls it would be greate favour ...................
    iam new to webservice
    iam getting this error when i run the client program
    C:\jakarta-tomcat-4.1.31\webapps\axis>java AttachmentServiceClient
    org.xml.sax.SAXException: Deserializing parameter 'sku': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}string
    iam using tomcat4.1, axis-1_3
    This is service file
    // SparePartAttachmentService.java
    import javax.activation.DataHandler;
    import java.io.*;
    public class SparePartAttachmentService {
    public SparePartAttachmentService(){}
    public String addImage (String sku, DataHandler dataHandler) {
    try {
    String filepath = "c:/wrox_axis/photo/" + sku +
    "-image.jpg";
    FileOutputStream fout = new FileOutputStream(new File (filepath));
    BufferedInputStream in =
    new BufferedInputStream(dataHandler.getInputStream());
    while (in.available()!= 0) {
    System.out.println("inside while");
    fout.write(in.read());
    } catch (Exception e) {
    return e.toString();
    return "Image: " + sku + " has been added successfully!!";
    This is wsdd file
    <deployment
    xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
    xmlns:ns1="AttachmentService">
    <service name="AttachmentService" provider="java:RPC">
    <parameter name="className"
    value="SparePartAttachmentService"/>
    <parameter name="allowedMethods"
    value="addImage"/>
    </service>
    <typeMapping qname="ns1:DataHandler"
    languageSpecificType="java:javax.activation.DataHandler"
    serializer="org.apache.axis.encoding.ser.
    JAFDataHandlerSerializerFactory"
    deserializer="org.apache.axis.encoding.ser.
    JAFDataHandlerDeserializerFactory"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </deployment>
    This is client file
    // AttachmentServiceClient.java
    import java.net.URL;
    import org.apache.axis.client.Service;
    import org.apache.axis.client.Call;
    import org.apache.axis.encoding.XMLType;
    import java.io.*;
    import javax.xml.rpc.ParameterMode;
    import javax.xml.namespace.QName;
    import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory;
    import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory;
    import javax.activation.FileDataSource;
    import javax.activation.DataHandler;
    public class AttachmentServiceClient {
    public AttachmentServiceClient(){}
    public static void main (String args[]) {
    try {
    String filename = "C:/jakarta-tomcat-4.1.31/webapps/axis/baby.jpg";
    System.out.println("filename " +filename);
    // Create the data for the attached file.
    DataHandler dhSource = new DataHandler (new
    FileDataSource (filename));
    System.out.println("filename " +dhSource);
    // EndPoint URL for the SparePartPrice Web Service
    String endpointURL =
    "http://localhost:8080/axis/services/AttachmentService";
    // Method Name to invoke for the Attachment Web Service
    String methodName = "addImage";
    // Create Call object and set parameters
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress (new java.net.URL(endpointURL));
    call.setOperationName (new QName("AttachmentService",
    methodName));
    call.addParameter("sku", XMLType.XSD_STRING,
    ParameterMode.IN);
    QName qname = new QName("AttachmentService", "DataHandler");
    call.addParameter("image", qname, ParameterMode.IN);
    // register the SparePartBean class
    call.registerTypeMapping(dhSource.getClass(), qname,
    JAFDataHandlerSerializerFactory.class,
    JAFDataHandlerDeserializerFactory.class);
    call.setReturnType(XMLType.XSD_STRING);
    // Setup the Parameters i.e. the Part SKU to be passed as
    // input parameter to the Attachment Web Service
    Object[] params = new Object[] { "SKU-111", dhSource };
    // Invoke the SparePartPrice Web Service
    String result = (String) call.invoke(params);
    // Print out the result
    System.out.println("The response: " + result);
    } catch (Exception e) {
    System.err.println(e.toString());
    }

    hi
    if any one can help me out pls it would be greate favour ...................
    iam new to webservice
    iam getting this error when i run the client program
    C:\jakarta-tomcat-4.1.31\webapps\axis>java AttachmentServiceClient
    org.xml.sax.SAXException: Deserializing parameter 'sku': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}string
    iam using tomcat4.1, axis-1_3
    This is service file
    // SparePartAttachmentService.java
    import javax.activation.DataHandler;
    import java.io.*;
    public class SparePartAttachmentService {
    public SparePartAttachmentService(){}
    public String addImage (String sku, DataHandler dataHandler) {
    try {
    String filepath = "c:/wrox_axis/photo/" + sku +
    "-image.jpg";
    FileOutputStream fout = new FileOutputStream(new File (filepath));
    BufferedInputStream in =
    new BufferedInputStream(dataHandler.getInputStream());
    while (in.available()!= 0) {
    System.out.println("inside while");
    fout.write(in.read());
    } catch (Exception e) {
    return e.toString();
    return "Image: " + sku + " has been added successfully!!";
    This is wsdd file
    <deployment
    xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
    xmlns:ns1="AttachmentService">
    <service name="AttachmentService" provider="java:RPC">
    <parameter name="className"
    value="SparePartAttachmentService"/>
    <parameter name="allowedMethods"
    value="addImage"/>
    </service>
    <typeMapping qname="ns1:DataHandler"
    languageSpecificType="java:javax.activation.DataHandler"
    serializer="org.apache.axis.encoding.ser.
    JAFDataHandlerSerializerFactory"
    deserializer="org.apache.axis.encoding.ser.
    JAFDataHandlerDeserializerFactory"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </deployment>
    This is client file
    // AttachmentServiceClient.java
    import java.net.URL;
    import org.apache.axis.client.Service;
    import org.apache.axis.client.Call;
    import org.apache.axis.encoding.XMLType;
    import java.io.*;
    import javax.xml.rpc.ParameterMode;
    import javax.xml.namespace.QName;
    import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory;
    import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory;
    import javax.activation.FileDataSource;
    import javax.activation.DataHandler;
    public class AttachmentServiceClient {
    public AttachmentServiceClient(){}
    public static void main (String args[]) {
    try {
    String filename = "C:/jakarta-tomcat-4.1.31/webapps/axis/baby.jpg";
    System.out.println("filename " +filename);
    // Create the data for the attached file.
    DataHandler dhSource = new DataHandler (new
    FileDataSource (filename));
    System.out.println("filename " +dhSource);
    // EndPoint URL for the SparePartPrice Web Service
    String endpointURL =
    "http://localhost:8080/axis/services/AttachmentService";
    // Method Name to invoke for the Attachment Web Service
    String methodName = "addImage";
    // Create Call object and set parameters
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress (new java.net.URL(endpointURL));
    call.setOperationName (new QName("AttachmentService",
    methodName));
    call.addParameter("sku", XMLType.XSD_STRING,
    ParameterMode.IN);
    QName qname = new QName("AttachmentService", "DataHandler");
    call.addParameter("image", qname, ParameterMode.IN);
    // register the SparePartBean class
    call.registerTypeMapping(dhSource.getClass(), qname,
    JAFDataHandlerSerializerFactory.class,
    JAFDataHandlerDeserializerFactory.class);
    call.setReturnType(XMLType.XSD_STRING);
    // Setup the Parameters i.e. the Part SKU to be passed as
    // input parameter to the Attachment Web Service
    Object[] params = new Object[] { "SKU-111", dhSource };
    // Invoke the SparePartPrice Web Service
    String result = (String) call.invoke(params);
    // Print out the result
    System.out.println("The response: " + result);
    } catch (Exception e) {
    System.err.println(e.toString());
    }

  • Join Nodes from different XML strings

    Hi,
    Please can you help me in joining 2 similar XML documents such that required nodes are appended.
    Need to combine the nodes of XML (input source:String) A and B as below:
    A:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MSG_Cont xmlns:ns0="http://xmlns.sample.xml.com/Xref">
        <ns0:Header>
            <ns0:ProjectName>Services-1</ns0:ProjectName>
            <ns0:TimeStamp>11-05-2007 08:24:08</ns0:TimeStamp>
        </ns0:Header>
        <ns0:Body>
            <ns0:MID_INTER_XREF>
                <ns0:INT_ID>0</ns0:INT_ID>
                <ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
                    <ns1:PERS_TITLE>MGR</ns1:PERS_TITLE>
                    <ns1:PERS_FIRST_NM>BUY</ns1:PERS_FIRST_NM>
                    <ns1:PERS_LAST_NM>INT</ns1:PERS_LAST_NM>
                </ns1:CDS_Person>
                <ns0:CLS>48</ns0:CLS>
                <ns0:COM>410</ns0:COM>
                <ns0:SW>P</ns0:SW>
                <ns0:ALT_ID>  </ns0:ALT_ID>
                <ns0:ACTV_CD>I</ns0:ACTV_CD>
                <ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
            </ns0:MID_INTER_XREF>
            <ns0:MID_INTER_XREF>
             <ns0:INT_ID>96</ns0:INT_ID>
             <ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
              <ns1:PERS_TITLE>MGR</ns1:PERS_TITLE>
              <ns1:PERS_FIRST_NM>TEMP</ns1:PERS_FIRST_NM>
              <ns1:PERS_LAST_NM>GRT</ns1:PERS_LAST_NM>
             </ns1:CDS_Person>
             <ns0:CLS>48</ns0:CLS>
             <ns0:COM>935</ns0:COM>
             <ns0:SW>D</ns0:SW>
             <ns0:ALT_ID>F$</ns0:ALT_ID>
             <ns0:ACTV_CD>A</ns0:ACTV_CD>
             <ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
         </ns0:MID_INTER_XREF>
        </ns0:Body>
    </ns0:MSG_Cont>B:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MSG_Cont xmlns:ns0="http://xmlns.sample.xml.com/Xref">
        <ns0:Header>
            <ns0:ProjectName>Services-1</ns0:ProjectName>
            <ns0:TimeStamp>11-05-2007 08:24:08</ns0:TimeStamp>
        </ns0:Header>
        <ns0:Body>
            <ns0:MID_INTER_XREF>
                <ns0:INT_ID>0</ns0:INT_ID>
                <ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
                    <ns1:PERS_TITLE>TECH</ns1:PERS_TITLE>
                    <ns1:PERS_FIRST_NM>BUY</ns1:PERS_FIRST_NM>
                    <ns1:PERS_LAST_NM>INT</ns1:PERS_LAST_NM>
                </ns1:CDS_Person>
                <ns0:CLS>98</ns0:CLS>
                <ns0:COM>910</ns0:COM>
                <ns0:SW>P</ns0:SW>
                <ns0:ALT_ID>  </ns0:ALT_ID>
                <ns0:ACTV_CD>I</ns0:ACTV_CD>
                <ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
            </ns0:MID_INTER_XREF>
            <ns0:MID_INTER_XREF>
             <ns0:INT_ID>96</ns0:INT_ID>
             <ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
              <ns1:PERS_TITLE>TECH</ns1:PERS_TITLE>
              <ns1:PERS_FIRST_NM>TEMP</ns1:PERS_FIRST_NM>
              <ns1:PERS_LAST_NM>GRT</ns1:PERS_LAST_NM>
             </ns1:CDS_Person>
             <ns0:CLS>98</ns0:CLS>
             <ns0:COM>435</ns0:COM>
             <ns0:SW>D</ns0:SW>
             <ns0:ALT_ID>F$</ns0:ALT_ID>
             <ns0:ACTV_CD>A</ns0:ACTV_CD>
             <ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
         </ns0:MID_INTER_XREF>
        </ns0:Body>
    </ns0:MSG_Cont>Combined (desired Output):
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MSG_Cont xmlns:ns0="http://xmlns.sample.xml.com/Xref">
        <ns0:Header>
            <ns0:ProjectName>Services-1</ns0:ProjectName>
            <ns0:TimeStamp>11-05-2007 08:24:08</ns0:TimeStamp>
        </ns0:Header>
        <ns0:Body>
            <ns0:MID_INTER_XREF>
                <ns0:INT_ID>0</ns0:INT_ID>
                <ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
                    <ns1:PERS_TITLE>MGR</ns1:PERS_TITLE>
                    <ns1:PERS_FIRST_NM>BUY</ns1:PERS_FIRST_NM>
                    <ns1:PERS_LAST_NM>INT</ns1:PERS_LAST_NM>
                </ns1:CDS_Person>
                <ns0:CLS>48</ns0:CLS>
                <ns0:COM>410</ns0:COM>
                <ns0:SW>P</ns0:SW>
                <ns0:ALT_ID>  </ns0:ALT_ID>
                <ns0:ACTV_CD>I</ns0:ACTV_CD>
                <ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
            </ns0:MID_INTER_XREF>
            <ns0:MID_INTER_XREF>
             <ns0:INT_ID>96</ns0:INT_ID>
             <ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
              <ns1:PERS_TITLE>MGR</ns1:PERS_TITLE>
              <ns1:PERS_FIRST_NM>TEMP</ns1:PERS_FIRST_NM>
              <ns1:PERS_LAST_NM>GRT</ns1:PERS_LAST_NM>
             </ns1:CDS_Person>
             <ns0:CLS>48</ns0:CLS>
             <ns0:COM>935</ns0:COM>
             <ns0:SW>D</ns0:SW>
             <ns0:ALT_ID>F$</ns0:ALT_ID>
             <ns0:ACTV_CD>A</ns0:ACTV_CD>
             <ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
         </ns0:MID_INTER_XREF>
         <ns0:MID_INTER_XREF>
             <ns0:INT_ID>0</ns0:INT_ID>
             <ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
              <ns1:PERS_TITLE>TECH</ns1:PERS_TITLE>
              <ns1:PERS_FIRST_NM>BUY</ns1:PERS_FIRST_NM>
              <ns1:PERS_LAST_NM>INT</ns1:PERS_LAST_NM>
             </ns1:CDS_Person>
             <ns0:CLS>98</ns0:CLS>
             <ns0:COM>910</ns0:COM>
             <ns0:SW>P</ns0:SW>
             <ns0:ALT_ID>  </ns0:ALT_ID>
             <ns0:ACTV_CD>I</ns0:ACTV_CD>
             <ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
         </ns0:MID_INTER_XREF>
         <ns0:MID_INTER_XREF>
             <ns0:INT_ID>96</ns0:INT_ID>
             <ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
              <ns1:PERS_TITLE>TECH</ns1:PERS_TITLE>
              <ns1:PERS_FIRST_NM>TEMP</ns1:PERS_FIRST_NM>
              <ns1:PERS_LAST_NM>GRT</ns1:PERS_LAST_NM>
             </ns1:CDS_Person>
             <ns0:CLS>98</ns0:CLS>
             <ns0:COM>435</ns0:COM>
             <ns0:SW>D</ns0:SW>
             <ns0:ALT_ID>F$</ns0:ALT_ID>
             <ns0:ACTV_CD>A</ns0:ACTV_CD>
             <ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
         </ns0:MID_INTER_XREF>
        </ns0:Body>
    </ns0:MSG_Cont>Trying to use the dom document.importNode() and appendChild(). But, looks like appendChild removes any already existing node (in this case - ns0:MID_INTER_XREF).
    Any help appreciated.
    TIA,
    Praveen

    Well, the requirement was to have elements from different XML in a single master XML. The way we achieved this - read from each XML, append to a string buffer and construct the combined XML (which passes on for use elsewhere).
    Hope this helps anyone with a similar requirement.
    Many Thanks for looking.

Maybe you are looking for

  • Is there a way to upload/download photos anonymously?

    Is there a way to anonymously upload/download photos to the web without any sort of identification? For example, if I'm using something like TOR to browse, and I find an icon on a site or Google Images that I want to use as my avatar for a social net

  • FM to calculate date month & year six months previous to the current date

    Hi All, Is there any function module or code to calculate date month & year six months previous to the current date. Thanks in advance.

  • SortByTime method complains trying to figure out why help please

    public void sortByTime() // check out the bubble sort code in Module 11 for an // example of what to do in this method // your code here (please remove this line) double fastRat = -1; int last = this.getSize() - 1; boolean didSwap = true; Time ratDif

  • Adobe Reader will not run with limited user account.

    I am trying to upgrade our Citrix Server Farm, from Reader 8.0 to 9.1, and am running into some issues.  First I uninstalled Adobe Reader 8.0 and then installed 9.1 from Adobe's site. Aftter the install completed I was able to run 9.1 without any pro

  • Run time error in TestStand

    Hi , I am getting run time error in teststand can any one suggest me how to use the #NoValidation directive in the expression? I was executing the same seq before but now i am getting error and it is getting strack when it comes to Action step( VI ca