473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.

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
May 2 '07 #1
1 1229
Help required for the above query.
May 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: arachno | last post by:
Hello ppl, Is anyone can help me to figure out how to add data to TextML server document base? I have attached snipped, which taking XML source from file and adding it to documentbase, but my...
5
by: Ed | last post by:
Hi, I have 2 sets of XML documents. XML1 is: <Root> <Node1>111</Node1> <Node2>222</Node2> <Node3>333</Node3> <Node4>
3
by: sal achhala | last post by:
I'm working with java and XML documents in order to search for keywords in a given element name, eg element name 'author' == "jo blogs". The problem is the XML documents are downloaded (this...
4
by: Steve Smith | last post by:
I need to add an additional String parameter to a Java SP (DB2 8.1 0 using DB2 Development Center - FP4). Everytime I do this I get the following error message when building:-...
115
by: junky_fellow | last post by:
What is a C object ? If i have some function "func()" in my C program, then can i say that "func()" is a C object ? or if i have some function pointer (ptr) which contains the address of...
17
by: Luc Mercier | last post by:
Hi Folks, I'm new here, and I need some advice for what tool to use. I'm using XML for benchmarking purposes. I'm writing some scientific programs which I want to analyze. My program generates...
11
by: AZRebelCowgirl73 | last post by:
here is the instructiions I am to use Ask the user to input the number of effective cars in the shop (this number should be between 1 and 100, inclusively). In a loop, controlled by the inputted...
2
by: sanjeevkt | last post by:
Hi All I need to merge two or more word documents int o single word docuemtn using JAVA. If someone knows API please tell me. Please Help Thanks in Advance. sanjeev
8
by: Martin Rinehart | last post by:
I asked Google for "javascript code conventions". He pointed me to seven convention documents. (More exactly, to Crockford and six lesser convention documents.) I have compiled all the conventions...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.