Re: Parsers vs. processors ???

Subject: Re: Parsers vs. processors ???
From: Matt Sergeant <matt@xxxxxxxxxxxx>
Date: Mon, 8 May 2000 17:44:17 +0100 (BST)
On Mon, 8 May 2000, Elder, Larry wrote:

> As a newbie, I'd like some help getting all the functions straight. 
> 
> What are all the inputs to the XML parsers? What are all the outputs?

The input is XML. The output depends on what parser, and what *type* of
parser. A SAX based parser outputs events. You pass an object in the
constructor of the parser on which to fire those events. A DOM based
parser returns a tree structure built from objects. There are other types
of XML parser, but those are the main 2. One of the more interesting
alternatives is PYX, which is pretty much a command-line tool for XML. You
supply it XML, and it spits out tokens for text tools like grep and
wc. There was an article on XML.com about PYX - implementations exist in
Python and Perl.

> What are all the inputs to the XSL processor? What are all the outputs?

Generally XSL processors can take almost anything: an XML file, a DOM
tree, or they can work off SAX events. In the first and last case they
generally build up some form of DOM tree before starting to work. They
also require one or more stylesheets. This can be found from the XML
file's <?xml-stylesheet?> processing instruction(s) or passed in manually
(again, as a DOM tree, file, or SAX events). The output tends to be a DOM
tree, although that can generally be serialized by the XSL processor, or
DOM library to either SAX events or an XML file. It's all one big picture
surrounding those three things: DOM, SAX and files.

Not that where I say "file" I mean both filename and filehandle, where
filehandle can generally be any type of open filehandle or socket.

Also note that not all processors implement all models. There's lots of
work going on to try and build a complete SAX based XSL processor (the
xml.apache.org group is one such project) and there's lots of XSL
processors that don't use the w3c DOM, but use some sort of internal node
structure. There are speed benefits to that, and also structural benefits
- for example, XPath specifies that the parent of an Attribute node is the
element node, but IIRC, DOM does not specify that to be the case.

Here's hoping I've got it mostly right...

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread