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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: expat tree-builder (dom)

[ Lists Home | Date Index | Thread Index ]
  • From: Andy Dent <dent@oofile.com.au>
  • To: Doug Forman <dforman@turnstone.com>
  • Date: Sat, 29 Jan 2000 13:08:29 +0800

Hi Doug
>Since my post, I was pressured to produce something, so I built something
>that sounds similar... a limitted  C++ wrapper around expat with utilities
>to configure the callbacks for you and collect tags and attributes interest.
The main added benefit of expatpp is the "sub-parser" model.

Parsing our report files is quite complex as we can nest multiple reports
within a single file and each report has independent
- report layout
- text styles attached to layout items
- adorners - serialised user code with user-saved data and signatures so
people can have
  shaders with their own logic.
- database schema
- data to import into the schema

Debugging this nested set of tags looked like a nightmare so I put a bit of
time into the sub-parser model. The static methods which are the callbacks
automatically handle the nesting depth so will return from the sub-parser
when it reaches its end tag. This vastly simplifies what the sub-parser has
to do. If it only needs to know a couple of tags within its domain then
that's all it evaluates in the startElement etc.

That also improves efficiency because you can optimise the checking of tags
for the most probable in a small locale. Our layout parser knows that it
will encounter <box> tags (CSS term used here to describe a box in which
<inline> elements are laid out) more often than others so can check for
them first.

With the sub-parsers having such limited domains we also are able to check
our output code rigorously by putting lots of asserts in the sub-parsers.

Andy Dent BSc MACS AACM, Software Designer, A.D. Software, Western Australia
OOFILE - Database, Reports, Graphs, GUI for c++ on Mac, Unix & Windows
PP2MFC - PowerPlant->MFC portability
http://www.oofile.com.au/

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/ or CD-ROM/ISBN 981-02-3594-1
Unsubscribe by posting to majordom@ic.ac.uk the message
unsubscribe xml-dev  (or)
unsubscribe xml-dev your-subscribed-email@your-subscribed-address

Please note: New list subscriptions now closed in preparation for transfer to OASIS.






 

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

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