[Re Cc'ing the list since the informations may be useful for others and worth archiving, Daniel]
On Fri, Feb 09, 2007 at 05:46:07PM +0100, Jovan Kostovski wrote: > On 2/9/07, Daniel Veillard <[EMAIL PROTECTED]> wrote: > > I would suggest to avoid SAX unless you have critical performance > >requirements, it will make your code 10 times easier to maintain if > >you use the reader instead: > > http://xmlsoft.org/xmlreader.html > > That's the reason why I tried usung SAX. I have to write a parser that will > work on embedded computer. It has a 200 MHz CPU with 128MB RAM > but there will be some big configuration files in (xml format) to handle. > The compiled code size matters too. > I saw from the examples that XMLReader is much more cleaner and easier > to use, but what are the system resouces needed comparing to SAX. > Since XMLReader is an interface to SAX2 it needs more memory, right? Perfectly right, that one of the few use case where using SAX makes sense, I would still try to use SAX version 2 though it's a bit more complex, the parser is faster, does more (namespace handling), and requires less allocation at run time. The main change are Element start and end callbacks, see http://xmlsoft.org/html/libxml-SAX2.html#xmlSAX2StartElementNs http://xmlsoft.org/html/libxml-SAX2.html#xmlSAX2EndElementNs you need a special magic version in SAX http://xmlsoft.org/html/libxml-parser.html#XML_SAX2_MAGIC see for example static xmlSAXHandler debugSAX2HandlerStruct in testSAX.c in the source distribution, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
