Connecting Tech Pros Worldwide Forums | Help | Site Map

Adding 2 XML Documents in Java.Please help.

Member
 
Join Date: Apr 2007
Posts: 56
#1: May 2 '07
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.

Expand|Select|Wrap|Line Numbers
  1.  
  2. DocumentOne 
  3. -----------
  4. <?xml version="1.0" encoding="UTF-8"?>
  5. <i:Interest xmlns:i="http://www.ABC.com/interests:i">
  6. <i:ID>0</i:ID><i:Generation/>
  7. <i:Delta/><i:Ref/>
  8. </i:Interest>
  9.  
  10. DocumentTwo
  11. -----------
  12.  
  13. <i:Underlying xmlns:i="common" xmlns:common="http://www.ABC.com/common" value="KGF">
  14.   <common:Code>KGF</common:Code> 
  15.   <common:Class>STOCK</common:Class> 
  16. </i:Underlying>
  17.  
  18.  
  19. Output Format
  20. -------------
  21.  
  22. <?xml version="1.0" encoding="UTF-8"?>
  23. <i:Interest xmlns:i="http://www.ABC.com/interests:i">
  24. <i:ID>0</i:ID><i:Generation/>
  25. <i:Delta/><i:Ref/>
  26. <i:Underlying xmlns:i="common" xmlns:common="http://www.ABC.com/common" value="KGF">
  27.   <common:Code>KGF</common:Code> 
  28.   <common:Class>STOCK</common:Class> 
  29. </i:Underlying>
  30. </i:Interest>
  31.  
  32.  
My Java code is trying to use this

Expand|Select|Wrap|Line Numbers
  1.  
  2. DocumentOne.importNode(DocumentTwo,true)
  3. DocumentOne.replaceChild...
  4.  

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

Help really appreciated

Member
 
Join Date: Apr 2007
Posts: 56
#2: May 2 '07

re: Adding 2 XML Documents in Java.Please help.


Help required for the above query.
Reply