?
Solved

DOM merging Documents?

Posted on 2003-03-20
4
Medium Priority
?
217 Views
Last Modified: 2013-11-23
Hi everybody,
I got to xml files like this

1.
<page>
  <filter>
     filtercontent
  </filter>
</page>

2.
<filter>
   filtercontent2
</filter>

Now I' parsing them both into 2 DOM Documents.
The question is:
 How can I insert the 2nd DOM document into the 1st Document, so that my 1st DOM Document will look like this.

<page>
  <filter>
     filtercontent
  </filter>
  <filter>
     filtercontent2
  </filter>
</page>

How do I do this, any suggestions??
Thanx in advance!!
-ulf-
0
Comment
Question by:ulf_k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 450 total points
ID: 8175255
 Take a look here for examples of adding and removing nodes into a DOM document: http://javaalmanac.com/egs/org.w3c.dom/pkg.html

  Hope it helps.
0
 

Author Comment

by:ulf_k
ID: 8175356
I been there too, but the main problem is to get a node from one document to the other.
I always get: "org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it."

Hmmm, how to detach the node from the one document to insert/append it to the other Document??

-ulf-
0
 

Author Comment

by:ulf_k
ID: 8175412
0
 
LVL 35

Expert Comment

by:girionis
ID: 8175832
 Thanks for the points. I am glad I helped :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question