APR folks, given that discussions on apr_xml haven't occurred (at least 
according to my brief searching of the archives) since 2001, I thought I'd ask 
a question:

Could a SAX-style (streaming) interface be added (like Expat's)? Particularly 
as "under the hood" is expat. DOM parsers are great (and greatly appreciated in 
certain circumstances) but for very large XML documents it means loading the 
entire DOM tree to get at one piece.

So I propose something along the following lines:

// need this for each of the Expat handlers
typedef int (*apr_xml_startelt_handler_t)(void *userData, const char *name, 
const char **atts);
APU_DECLARE(apr_status_t) apr_xml_sax_startelement_handler(apr_xml_parser 
*parser, apr_xml_startelt_handler_t handler);
//...
APU_DECLARE(apr_status_t) apr_xml_parse_file_sax(apr_pool_t *p,
                                             apr_xml_parser **parser,
                                             apr_file_t *xmlfd,
                                             apr_size_t buffer_length); // note 
no doc output, although it would be neat to be able to do both SAX and DOM in 
certain cases

Of course, you could just tell me to use Expat directly...As I am currently 
doing. But reducing my direct dependence, and providing for multiple SAX parser 
backends might be nice.

Reply via email to