W3C home > Mailing lists > Public > www-dom@w3.org > April to June 1999

Re: DOM and document creation

From: Oliver Becker <obecker@informatik.hu-berlin.de>
Date: Tue, 13 Apr 1999 14:26:20 +0200 (MET DST)
Message-Id: <199904131226.OAA23636@mail.informatik.hu-berlin.de>
To: www-dom@w3.org, hassan.hussein@zurich.com
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT