Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

DOM merging Documents?

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
ulf_k
Asked:
ulf_k
  • 2
  • 2
1 Solution
 
girionisCommented:
 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
 
ulf_kAuthor Commented:
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
 
ulf_kAuthor Commented:
0
 
girionisCommented:
 Thanks for the points. I am glad I helped :-)
0

Featured Post

Industry Leaders: 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!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now