You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by "ZAHIR, Mehnaaz, FM" <Me...@rbos.com> on 2000/09/25 10:56:10 UTC

How to join 2 XML Documents into one..

I have been on this problem for quite some time now.... the problem is like
this....

1. templateXML --> I've one XML template -- type is 'Document'
2. dataXML --> and I've a business XML data being generated -- type again is
'Document'
3. The above dataXML(2) needs to append itself, to the end of the
'templateXML(1)' document, before it can be processed by my XSLT....
4. So HOW do I append the (no.2) to (no.1) ?

I am trying the following approach...

	Element dataRootElement = dataXML.getDocumentElement();
	Node n = // here I need to convert the above 'Element' to Node
	Document doc = (Document) templateXML.importNode ( n, true );

So this will give me back the Document 'templateXML' appended with 'dataXML'
--- to be fed to XSLT to produce HTML.... But I am not quite sure how I may
go about it..... May this whole approach is wrong? Any help will be greatly
appreciated....

I have searched the faqs too on both the Sun's and Apache's site...  but to
no avail....
I am using Xerces 1.2.0... so I can use 'importNode()'....

Thanks and rgrds
mehnaaz




********************************************************************
This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
********************************************************************