You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Pierpaolo Fumagalli <pi...@apache.org> on 2000/02/02 20:07:11 UTC

SAX2 and DOM...

I have an idea...
	I already have some classes doing SAX-to-DOM translation, and
I'm currently in the process of bringing them from SAX version 1 to
version 2.
Since with SAX 2.0 we'll be able to fully build a DOM, what about
"dropping" the current DOMParser and SAXParser, keeping just one of them
(the SAX one) and relying on a SAX-to-DOM to get the documents?
I don't know how DOM level 2 and 3 would fit in this picture, but, as
far as I'm concerned (DOM1) this is more than possible...

	Pier

BTW... I made some speed tests on Xerces, and I must say that
performances are G.R.E.A.T.  I always knew that Xerces was fast, but not
THAT fast (basically 90% of the time spent in parsing is I/O, processing
the XML data is just 10%). Congratulations go to all the team... (I had
to say that!)
-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------



Re: SAX2 and DOM...

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Andy Clark wrote:
> 
> Unfortunately, there are currently features in DOM that are
> not possible to build via SAX2 callbacks. And I would guess
> that this separation will only increase over time as the
> various DOM specifications are developed.
> [...]

Point.... :) A good one...
Agreed

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: SAX2 and DOM...

Posted by Andy Clark <an...@apache.org>.
Pierpaolo Fumagalli wrote:
> Since with SAX 2.0 we'll be able to fully build a DOM, what about
> "dropping" the current DOMParser and SAXParser, keeping just one of them
> (the SAX one) and relying on a SAX-to-DOM to get the documents?
> I don't know how DOM level 2 and 3 would fit in this picture, but, as
> far as I'm concerned (DOM1) this is more than possible...

Unfortunately, there are currently features in DOM that are
not possible to build via SAX2 callbacks. And I would guess
that this separation will only increase over time as the
various DOM specifications are developed.

For example, how would you use SAX2 callbacks to put general
entity references in attribute values of DOM elements? (We
don't actually have the capability to do this now -- but we
should!) And when DOM Level 3 handles grammar access, what
SAX2 calls are going to allow this to be generated? We would
need a SAX3, SAX4, and so on just to keep up with DOM
compliance.

For more examples from DOM Level 1, think about default 
attribute values. Where does SAX2 allow the handler to know
what these are so that the DOM behaves correctly when
editing an element's attributes? org.xml.sax.Attributes
doesn't even tell you if the attribute was specified or
defaulted from the grammar.

I would say that DOM and SAX are different enough to argue
for keeping them separate. Just because you can build a
subset of the DOM from SAX2 callbacks doesn't mean that we
should restrict all DOM trees to be constructed this way
using our parser.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org

Re: SAX2 and DOM...

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Paul Prescod wrote:
> 
> Pierpaolo Fumagalli wrote:
> >
> 
> > Since with SAX 2.0 we'll be able to fully build a DOM, what about
> > "dropping" the current DOMParser and SAXParser, keeping just one of them
> > (the SAX one) and relying on a SAX-to-DOM to get the documents?
> 
> I strongly support this idea. It will be useful to be able to build DOMs
> from the results of filters and XSLT transforms. This is doable if the
> DOM Builder is just another SAX event consumer.

It's working right now in SAX1, but in SAX1 I can't deal w/ stuff like
CDATA and Comments... SAX2 adds this capability, so, as soon as Xerces
will support the new SAX2 APIs, I'll convert my classes and place
them....
WHERE??? Package? (org.apache.xerces.dom? org.apache.xml.tools?)

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: SAX2 and DOM...

Posted by Paul Prescod <pa...@prescod.net>.
Pierpaolo Fumagalli wrote:
> 

> Since with SAX 2.0 we'll be able to fully build a DOM, what about
> "dropping" the current DOMParser and SAXParser, keeping just one of them
> (the SAX one) and relying on a SAX-to-DOM to get the documents?

I strongly support this idea. It will be useful to be able to build DOMs
from the results of filters and XSLT transforms. This is doable if the
DOM Builder is just another SAX event consumer.
-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
"Ivory towers are no longer in order. We need ivory 
networks. Today, sitting quietly and thinking is the 
world´s greatest generator of wealth and prosperity."
 - http://www.bespoke.org/viridian/print.asp?t=140