[XML-DEV Mailing List Archive Home]
[Reply To This Message]
Re: Switching between DOM and SAX
- From: David Brownell <db@E...>
- To: xml-dev@i...
- Date: Thu, 01 Oct 1998 06:45:12 -0700
[ Resend, now that I can post again ]
- From: David Brownell <db@e...>
- To: xml-dev@i...
- Date: Tue, 22 Sep 1998 10:21:05 -0700
John Cowan wrote:
> Sure, but in SAX (event stream) to DOM conversion, you need to capture
> *all* the SAX events if you are to be able to satisfy the guarantees
> that the DOM model makes.
Well, sort of ... the "capture" can be as weak as "accept the callback
to see if you want to save that bit of content". DOM doesn't guarantee
much, and since converting from text/URI/... to a DOM Document object is
out of scope for level 1, ANY games you play that provide a DOM node at
the end of the process are legal. (On the other hand, SAX assumes that
you parse entire documents ... reasonable, that's how XML is defined.)
For example, it's well within the DOM spec to have an element which
is part of a document but has no parent. (Take a document that has
only a root element; remove that child element, voila!) You could build
one like that while you parse, and return it ... having discarded any
parent nodes you weren't interested in.
Similarly, you can take XML document text and turn it into a DOM tree
that's not isomorphic with the input text because it's been transformed.
Algorithmic transformations are possible, so are XSL-driven ones.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please