Re: merging two XMLs in java

Kevin Jones <[email protected]> Wed, 10 Jul 2002 19:38:41 +0100
Newsgroups gmane.comp.windows.devel.java.general
Message-ID <02cb01c22841$04ebe930$0200a8c0@yossarian>
This is a multi-part message in MIME format.

------=_NextPart_000_02CC_01C22849.66B05130
Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: 7bit

You need to import the node into the 'receiving' document.

Look at org.w3c.dom.Document.importNode


Kevin Jones
Developmentor
www.develop.com


-----Original Message-----
From: Java Discussion [mailto:[email protected]] On Behalf Of
Bernhard Gruber
Sent: 10 July 2002 18:36
To: [email protected]
Subject: [JAVA] merging two XMLs in java


hi all

my task is, to merge two (or more) different XML-Documents to one (which
I want to return as a String (!!!)

i use

oracle.xml.parser.v2.*;
org.w3c.dom.*;

walking through the single XMLs works perfectly and getting the Nodes
(and Nodelists) I want to put together in one Doc works also -->
BUT when i try to append one of the detected Nodes (somewhere) in the
XMLDocument, which should put everything together I get :

oracle.xml.parser.v2.XMLDOMException: Node doesn't belong to the current
document.

can anybody help me ??
By the way : I doent really know the correct way to get a String from an
XMLDocument

tnx

bernie

You can read messages from the JAVA archive, unsubscribe from JAVA, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.


You can read messages from the JAVA archive, unsubscribe from JAVA,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

------=_NextPart_000_02CC_01C22849.66B05130
Content-Type: text/html;
        charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D336533618-10072002><FONT face=3DArial color=3D#0000ff =
size=3D2>You=20
need to import the node into the 'receiving' =
document.</FONT></SPAN></DIV>
<DIV><SPAN class=3D336533618-10072002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D336533618-10072002><FONT face=3DArial color=3D#0000ff =
size=3D2>Look=20
at org.w3c.dom.Document.importNode</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV><!-- =
Converted from text/plain format -->
<P><FONT size=3D2>Kevin =
Jones<BR>Developmentor<BR>www.develop.com<BR></FONT></P>
<BLOCKQUOTE=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT=20
  face=3DTahoma size=3D2>-----Original Message-----<BR><B>From:</B> Java =
Discussion=20
  [mailto:[email protected]] <B>On Behalf Of </B>Bernhard=20
  Gruber<BR><B>Sent:</B> 10 July 2002 18:36<BR><B>To:</B>=20
  [email protected]<BR><B>Subject:</B> [JAVA] merging two XMLs in =

  java<BR><BR></FONT></DIV>hi all<BR><BR>my task is, to merge two (or =
more)=20
  different XML-Documents to one (which I want to return as a String=20
  (!!!)<BR><BR>i use=20
  <BR><BR>oracle.xml.parser.v2.*;<BR>org.w3c.dom.*;<BR><BR>walking =
through the=20
  single XMLs works perfectly and getting the Nodes (and Nodelists) I =
want to=20
  put together in one Doc works also --&gt;<BR>BUT when i try to append =
one of=20
  the detected Nodes (somewhere) in the XMLDocument, which should put =
everything=20
  together I get :<BR><BR><FONT face=3D"MS Sans Serif, Geneva"=20
  size=3D1>oracle.xml.parser.v2.XMLDOMException: Node doesn't belong to =
the=20
  current document.<BR><BR></FONT>can anybody help me ??<BR>By the way : =
I doent=20
  really know the correct way to get a String from an=20
  XMLDocument<BR><BR>tnx<BR><BR>bernie<BR><BR>You can read messages from =
the=20
  JAVA archive, unsubscribe from JAVA, or subscribe to other =
DevelopMentor lists=20
  at http://discuss.develop.com. </BLOCKQUOTE></BODY></HTML>
You can read messages from the JAVA archive, unsubscribe from JAVA,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

------=_NextPart_000_02CC_01C22849.66B05130--