← Prev in month ← Prev in thread

SAX is not a read-only API (wa RE: [xml-dev] re: XML SIG 17...)

From
Aaron Skonnard <>
To
'Elliotte Rusty Harold' <>,
Date
2002-09-12T17:50:26Z
ID
<028301c25a84$e151c2d0$0600a8c0@gandalf>
Thread
SAX is not a read-only API (wa RE: [xml-dev] re: XML SIG 17...)
Elliotte Rusty Harold wrote:

> At 11:09 AM -0600 9/12/02, Aaron Skonnard wrote:
> 
> > Since when is SAX a "read-only API"? SAX is simply a suite 
> > of interface definitions for programmatically representing 
> > XML documents. Why does it matter what side of the interface 
> > you're on? It's still SAX.
> 
> Is there a single method call anywhere in the three SAX packages that
> actually creates a fragment of XML? 


I assume you're referring to an XML Infoset, and not XML 1.0, since that
what the API models. If so, sure, characters produces a fragment of XML
in a single call. But why does it matter if it's a single call anyway? A
sequence of calls can model an XML Infoset in an intuitive manner.


> You can create a few helper classes like AttributesImpl. but there's 
> nothing to actually put them in a file or on a stream. 

Who cares where it goes? SAX is about programmatically modeling
Infosets.

> Where are the SAX calls to create a new XML document? 

ch.startDocument();
// document content goes here...
Ch.endDocument();

> They don't exist. SAX is a read-only API. It supports
> parsing of XML documents, but has no support whatsoever for creating
> new XML documents, modifying XML documents, or writing them onto
> streams. You can write code to do all this yourself. Just don't
> pretend that code is part of SAX.

The SAX interfaces don't mandate "parsing of XML documents", although
the interfaces can be used for this common task, as well as others. 

-aaron

......................................................
. Aaron Skonnard, DevelopMentor (http://skonnard.com).
.  Essential XML Quick Reference available online!   .
.    Download PDFs: http://www.develop.com/books     .
......................................................
← Prev in month ← Prev in thread