libxml2's SAX

Vassili Dzuba vassilidzuba at nerim.net
Mon Jan 27 13:49:42 PST 2003


On Mon, 27 Jan 2003 17:48:55 +0000 (UTC)
jamie_bennett at pcpmicro.co.uk (Jamie Bennett) wrote:

> Hi,
> 
>   Going through the nALFS code line by line to try and understand it
> I came across this little comment - 
> 
> /* TODO:
>  * This is WRONG. Constructing libxml2's tree, reading it and creating
>  * our own structures, and then freeing it is plain stupid.
>  * But since libxml2's SAX won't play nice, this will have to be used
>  * for a while.
>  */
> 
>   Why doesn't SAX play nicely and is it on your list of things to do?
> 
> 	********************************************
> 	* Jamie Bennett     - 18 St Peters Terrace *
> 	* Software Engineer - Lower Bristol Road   *
> 	* PCP Microproducts - Bath, England        *
> 	* jamie_bennett at pcpmicro.co.uk             *
> 	********************************************


Hi,

While theoretically it would be better to use
SAX than DOM to avoid an intermediate tree,
in practice the parsing of a profile, even
a large one like BLFS.xml, is quite fast
and the user won't probably see the difference.

For the fun, i used SAX for YAALFS and indeed the 
handling of entities is quite tricky and not very
clearly documented (the documentation is the source...).
I think i have it working, but i spent a lot of time on it
and i'm not sure that all the cases are taken into
account.

Another reason not to use SAX is that, AFAIK, there
is no support of xInclude through SAX. So, I will
need to write myself a support of (very small subset of)
xInclude on top of SAX, or go the DOM way.

As xInclude requires XPath, it's very difficult to
implement it if one hasn't the full tree available.

So, I think that the support of xInclude is a reason
good enough for nALFS to stay with DOM.

Vassili Dzuba




> -- 
> Unsubscribe: send email to listar at linuxfromscratch.org
> and put 'unsubscribe alfs-discuss' in the subject header of the message
> 
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message



More information about the alfs-discuss mailing list