OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Compositional Documents

[ Lists Home | Date Index | Thread Index ]
  • From: Chris Berry <CBerry@works.com>
  • To: "'xml-dev@ic.ac.uk'" <xml-dev@ic.ac.uk>
  • Date: Tue, 2 Feb 1999 12:11:01 -0600

Sorry for the wasted bandwidth, but I posted this last night (without 
a Subject) and did not receive any response.  I'm hoping this time 
around I might be luckier...

I am a relative newbie to XML, so please bear w/ me if this is a poor

It looks like everything in the DOM must be dealt w/ in the context of a
particular document. It seems you cannot drop one Document into another, or
even one DocumentFragment into another Document context. I have tried to do
the following... (using Microsoft's implementation of the DOM) 

   IXMLDOMDocument doc = (IXMLDOMDocument) new DOMDocument();
   IDOMDocumentFragment docFrag = doc.createDocumentFragment();

   IDOMElement userElem = doc.createElement("USER");
   userElem.setAttribute("TIMESTAMP", new Variant("123456") );

   docFrag.appendChild( userElem );

   doc.appendChild( docFrag );
   System.out.println( doc.getXml() );   // >>>> Yields the correct results
   IXMLDOMDocument doc2 = (IXMLDOMDocument) new DOMDocument();
   doc2.appendChild( docFrag );
   System.out.println( doc2.getXml() );  // >>>> Yields an empty string

It seems like this should work to me. Shouldn't we be able to cut and paste
between documents?? Or more important, shouldn't we be able to build up
documents compositionally?? I.e. compose Address 1 and Address 2 as
DocumentFragments (or as their own Documents -- with their own DTDs) 
and then drop these into, say, User (providing that the User DTD agrees).

I must be missing something here.
Thanks in advance,
-- Chris

Chris Berry            cberry@works.com          512-231-1341
works.com     6850 Austin Center Blvd.      Austin, TX 78731

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS