RE: expat tree-builder (dom)
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@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1 Unsubscribe by posting to majordom@i... 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.
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