Re: DOM and document creation

Hi,

> am getting confused as to how the document creation and parsing is performed.  
I
> know that to parse a document you must already have  a document, then parse 
it,
> then the parser will return a DOM tree and one can use that tree to manipulate
> the document.
> 
> I wonder how the reverse is done - I mean - I have no document and want to
> create one on the fly, do I need the parser only, the DOM only, or both.  Also
> where does the SAX get in??

As far as I understand the specification it makes no statements about
how to create a Document. This is left as an implementation detail.

The common way would to use any kind of DOM parser that creates the
DOM tree out of a XML document. Which kind of interface or operation
has to be used is not part of the DOM specification. Analogous it is
not specified how to create an empty Document on the fly.

But if you have such object, then you may call several createXXX and
insertXXX methods to fill your document tree.

The last question concerning SAX: that's an approach to parse XML
documents (texts). There's no requirement that a DOM parser has to base
on a SAX parser -- in fact most DOM parsers do, I think.

As I am relatively new to this subject too, the DOM experts may
correct me if I understand something wrong.

Best regards,
Oliver

/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/

Received on Tuesday, 13 April 1999 08:26:27 UTC