OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Fw: DOM vs. SAX??? Nah. (was RE: Storing Lots of Fiddly Bits (was Re: W

[ Lists Home | Date Index | Thread Index ]
  • From: "Oren Ben-Kiki" <oren@capella.co.il>
  • To: "XML List" <xml-dev@ic.ac.uk>
  • Date: Sat, 13 Feb 1999 11:57:45 +0200

Don Park <donpark@quake.net> wrote:

>I wrote:
>>I know it is available - just as there are tools to build a DOM tree from
>>SAX events. I'd just like to see SAX being given an official standing
>>_within_ the DOM specs as "the" DOM visitor interface. Ideally, SAX would
>be
>>part of the DOM specs.
>
>Oren,
>
>Its a nice idea but it conflicts with at least one DOM API requirement:
>JavaScript support.  Predicate Functors can be contrived with JavaScript
but
>not multifacet callback interfaces like SAX.


I don't quite see why, but I admit to being hazy on the fine points of the
DOM API. How do these "Predicate Functors" effect the API of applying a
visitor to a constructed DOM tree?

David Megginson <david@megginson.com> raised another objection:
>...  It hardly makes sense to have
>
>  startElement(String name, org.xml.sax.AttributeList atts)
>
>when you could simply have
>
>  startElement(org.w3c.dom.Element element)

Well, applying a visitor to the tree does, classically, accept the tree
node. But in this particular case, it makes more sense to give the visitor a
restricted view of the node. This allows us to gain all the benefits of SAX
while still marrying the two interfaces. For the cases where access to the
node is useful, one could add a method to the SAX API:

org.w3c.dom.Element getElement();

Which would return null if the visitor is applied to a "virtual DOM", such
as in a parser, and would return the element, in case it is applied to a
real DOM tree. Hmmm - this would introduce a dependency between the SAX API
and the DOM API, which we really want to avoid. In some languages (C++),
this can be avoided by defining 'org.w3c.dom.Element' to be an unknown
"external class" without creating a dependency. In Java we could just return
an Object... I'm certain this is solvable at some level.

Share & Enjoy,

    Oren Ben-Kiki


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS