Adding 2 XML Documents in Java.Please help.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luthriaajay
    New Member
    • Apr 2007
    • 56

    #1

    Adding 2 XML Documents in Java.Please help.

    Has anyone used the 'importNode' and the 'replaceChild' methods
    of Interface Document and Node or adding 2 XML documents ?

    I need to add 2 XML documents in Java.

    Code:
    DocumentOne 
    -----------
    <?xml version="1.0" encoding="UTF-8"?>
    <i:Interest xmlns:i="http://www.ABC.com/interests:i">
    <i:ID>0</i:ID><i:Generation/>
    <i:Delta/><i:Ref/>
    </i:Interest>
    
    DocumentTwo
    -----------
    
    <i:Underlying xmlns:i="common" xmlns:common="http://www.ABC.com/common" value="KGF">
      <common:Code>KGF</common:Code> 
      <common:Class>STOCK</common:Class> 
    </i:Underlying>
    
    
    Output Format
    -------------
    
    <?xml version="1.0" encoding="UTF-8"?>
    <i:Interest xmlns:i="http://www.ABC.com/interests:i">
    <i:ID>0</i:ID><i:Generation/>
    <i:Delta/><i:Ref/>
    <i:Underlying xmlns:i="common" xmlns:common="http://www.ABC.com/common" value="KGF">
      <common:Code>KGF</common:Code> 
      <common:Class>STOCK</common:Class> 
    </i:Underlying>
    </i:Interest>
    My Java code is trying to use this

    Code:
    DocumentOne.importNode(DocumentTwo,true)
    DocumentOne.replaceChild...

    Please,has anyone used the above methods?
    How can I add both the XML docs?

    Help really appreciated
  • luthriaajay
    New Member
    • Apr 2007
    • 56

    #2
    Help required for the above query.

    Comment

    Working...