xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Dupras <bri...@centera.com>
Subject RE: Merge multiple XML Docs into one XML Doc
Date Tue, 25 Jan 2000 20:29:16 GMT
:(  I feel a little silly now...

NON-DOM:
public Node importNode(Node source,
                       boolean deep)
                throws DOMException


This looks like what I need.  I wish there was a standard DOM way, but this
should do fine.

::sigh::

> -----Original Message-----
> From: Brian Dupras [mailto:briand@centera.com]
> Sent: Tuesday, January 25, 2000 1:25 PM
> To: 'general@xml.apache.org'
> Subject: RE: Merge multiple XML Docs into one XML Doc
> 
> 
> Hello again Scott,
> 
> > Just use xsl:copy-of in XSLT.   <xsl:copy-of select="document
> > ('http://foo.com/blah.xml')/*"/>  should copy the document element &
> > children of blah.xml to the result tree.
> 
> 
> Hmm....  Not quite what I'm looking to do
> 
> The verbalize the process:
> 
> 	"Into a given Element of the existing DOM Document 
> 'target', insert
> replicas of given Elements from existing DOM Documents 
> 'source1', 'source2',
> ..., 'sourceN'".
> 
> From what I understand, DOM Nodes aren't directly portable 
> from one Document
> to another.  Is this true?
> 
> 
> Actual example:
> 
> Document 'Target' represents a dynamically generated xhtml 
> body element
> <html:body> with any number of <html:*> child elements.  
> Inside 'Target'
> somewhere is a <pp:cell id="CONTENT">
> 
> Document 'navStruct' is an xml document with <pp:metada> and 
> <pp:data>.  The
> children of <pp:data> are any number of <html:*> child 
> elements.  Somewhere
> inside 'navStruct'/<pp:data> is a <pp:cell id="BODY"/> that marks the
> position for more dynamically generated xhtml.  Once 
> processed, the children
> of <pp:data> replace Target's <pp:cell id="CONTENT">.
> 
> Document 'bodyStruct' is an xml document with <pp:metada> and 
> <pp:data>.
> The children of <pp:data> are any number of <html:*> child 
> elements that
> replace navStruct's <pp:cell id="BODY"/>.  
> 
> 'Target' then runs through a final XSL that dumps the xhtml 
> to an HTML 4
> <BODY> element and then gets incorporated into the output stream.
> 
> 
> To complicate, this process is layered - pieces of multiple docs get
> insterted into various targets, and those targets become pieces to be
> insterted to a master target. 
> 
> 
> (None of the documents exist on the filesystem or at an http 
> address - these
> DOM Documents have been previously created by an automated 
> process.  The
> Document 'Target' is volatile - it'll never be saved out to a 
> filesystem.)
> 
> Does this better exlpain what I need to do?  (Or does it 
> sound the same as
> before?)
> 
> 
> 
> Brian
> 
> 
> > -----Original Message-----
> > From: Scott Boag/CAM/Lotus [mailto:Scott_Boag@lotus.com]
> > Sent: Tuesday, January 25, 2000 11:30 AM
> > To: general@xml.apache.org
> > Subject: Re: Merge multiple XML Docs into one XML Doc
> > 
> > 
> > 
> > Just use xsl:copy-of in XSLT.   <xsl:copy-of select="document
> > ('http://foo.com/blah.xml')/*"/>  should copy the document element &
> > children of blah.xml to the result tree.
> > 
> > -scott
> > 
> > 
> > 
> > 
> >                                                               
> >                                                      
> >                     Brian Dupras                              
> >                                                      
> >                     <briand@cente        To:     "Xml-Apache 
> > (E-mail)" <general@xml.apache.org>                    
> >                     ra.com>              cc:     (bcc: Scott 
> > Boag/CAM/Lotus)                                       
> >                                          Subject:     Merge 
> > multiple XML Docs into one XML Doc                     
> >                     01/25/00                                  
> >                                                      
> >                     01:16 PM                                  
> >                                                      
> >                     Please                                    
> >                                                      
> >                     respond to                                
> >                                                      
> >                     general                                   
> >                                                      
> >                                                               
> >                                                      
> >                                                               
> >                                                      
> > 
> > 
> > 
> > 
> > OK - this should be an easy one, but so far I've yet to find 
> > a definitive
> > answer.
> > 
> > 
> > I have a system where I'm given multiple XML DOM Documents 
> > that I need to
> > process and merge into a single DOM Document.  The known 
> > portions of the
> > input Documents get processed, while the unknown portions 
> > need to be copied
> > over directly.
> > 
> > 
> > The question is, how do I properly insert entire nodes (and their
> > childeren)
> > from one document to another?  Do I have to write my own 
> > recursive copy
> > routine?
> > 
> > I'm free to use either the DOM functions, or XSLT.
> > 
> > 
> > Brian
> > 
> > 
> > Given as DOM Documents:
> >            <doc1>
> >                      <foo>
> >                                <replaceme id="a"/>
> >                      </foo>
> >                      <bar/>
> >            </doc1>
> > 
> >            <doc2>
> >                      <bar>
> >                                <replaceme id="b">
> >                                <inserthere thexml="doc1">
> >                      </bar>
> >                      <foo/>
> >            </doc2>
> > 
> >            <doc3>
> >                      <inserthere thexml="doc1">
> >            </doc3>
> > 
> > 
> > Created from scratch:
> >            <output>
> >                      <bar>
> >                                <replaced>doc2 id b</replaced>
> >                                <foo>
> >                                           <replaced>doc1 id 
> > a</replaced>
> >                                </foo>
> >                                <bar/>
> >                      </bar>
> >            </output>
> > 
> > 
> > 
> > 
> > 
> > Brian Dupras
> > Centera Information Systems, Inc.
> > phone           303.939.0200 x294
> > fax        303.939.0111
> > web        http://www.centera.com
> > email           briand@centera.com
> > 
> > 
> > 
> > 
> 

Mime
View raw message