[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: (more) extensible SAX
Hi Ken, Ken MacLeod wrote: > > Eric van der Vlist <vdv@d...> writes: .../... > > While this is certainly an important difference, I don't see it as > > the main difference, but I'd rather say that the main difference is > > that SAX and DOM are acting at different levels and that SAX is the > > most "neutral" interface, DOM being more biased by a specific > > interpretation of what is a XML document. > > I'll start off by saying I disagree a little with your premise, but > agree with your conclusion :-) :-) > SAX and DOM both present the XML InfoSet, one in parse sequence (as a > stream) and one after parsing is complete (as a tree, and some > libraries offer a mix of the two). Yes, but which XML Infoset ? The notion seems very flexible and different amongst the specifications :) ... .../... > > What do I mean concretely ? > > > > Instead of: > > > > startElement(java.lang.String namespaceURI, > > java.lang.String localName, > > java.lang.String qName, > > Attributes atts) > > throws SAXException > > > > I would have far preferred to have: > > > > startElement(org.xml.sax.StartElement start) > > throws SAXException > > .../... > Coincidentally, this is one of the major feature differences with Perl > SAX[a] (being descussed in the "SAX Comments" thread[b]). Perl SAX has > always used a node as the argument to SAX events. In our case, > though, it's not a "start element" or "end element" object, but just > an element node, a DOM node, to be exact. > > For SAX2's namespaces, all that needed adding was Prefix, LocalName, > and NamespaceURI properties to the nodes. That's interesting (and proves me that I shouldn't be that Java biased) especially after the comment from Elliotte Rusty Harold about the added complexity of such an architecture. What's your feeling after having implemented and used it ? > For "raw" parsing, one need only add "raw" information properties, > like "OriginalStartTag", "OriginalEndTag". (No one's done that yet, > but it's on the wish list.) :) > Namespace support was such a "simple" change to Perl SAX, that we now > face the dilemma of changing the class names just because the SAX2 > Java implementation had to change interfaces to support these new > features. Yes, I can imagine and that was one of my points. > "Marrying SAX and DOM" was discussed briefly here on xml-dev[c] and on > Python's XML-SIG[d,e]. > > > I don't see anything but advantages, one of them being the > > extensiblity: with this architecture, SAX2 would just have been a > > layer on top of SAX1. > > > > Have I miss something ? > > Not that I can see, in Perl this has been working splendidly for about > 18 months. Thanks. Eric > -- Ken > > > [1] http://www.xml.com/pub/a/2000/08/09/xslt/xslt.html > > [2] http://lists.xml.org/archives/xml-dev/200011/msg00551.html > > [a] <http://bitsko.slc.ut.us/~ken/perl-xml/sax-2.0.html> > [b] <http://lists.xml.org/archives/xml-dev/200012/msg00047.html> > [c] <http://lists.xml.org/archives/xml-dev/200003/msg00316.html> > [d] <http://mail.python.org/pipermail/xml-sig/2000-February/001905.html> > [e] <http://mail.python.org/pipermail/xml-sig/2000-February/001907.html> > follow the thread on "EasySAX" -- See you at XML 2000 http://gca.org/attend/2000_conferences/XML_2000/building.htm#vlist ------------------------------------------------------------------------ Eric van der Vlist Dyomedea http://dyomedea.com http://xmlfr.org http://4xt.org http://ducotede.com ------------------------------------------------------------------------
|
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
|