apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: Any interest in a apr_xml_parse_file ?
Date Tue, 07 Aug 2001 00:44:12 GMT
On Thu, Aug 02, 2001 at 07:52:39PM -0700, Ian Holsman wrote:
> hi.
> 
> Just wondering if there is any interest in implementing a apr_xml 
> function which will convert
> a file into a apr_xml_doc**  

Yes. This would be good. We discussed this kind of functionality a while
back, for implementing XML-based configuration files.

Note the one caveat: apr_xml_doc is essentially a super lightweight DOM like
thing. Thus, the whole file would be parsed into memory. This is no big
deal, but should be noted in the header comments for the function.

(if an app is concerned about memory footprint, then they must use a SAX
 style of interface)

> the only issue I have is I don't know how to pass an error out of the code.
> It would sit in APR-UTIL, but it could generate an error from a APR call 
> or a APR-XML call

I'm not sure that I understand this one. If there is an error, then you stop
the parse and return it. Doesn't sound complicated...

Note that the XML Specification states that once a parse error is found,
then the parser should(?) terminate; recovery is not required, nor is it
even encouraged. (btw, I don't believe you can restart Expat)

> If anyone is interested I'll convert the code to APR-code guidelines and 
> pretty it up a bit.

Sure. I'd suggest calling it apr-util/xml/parse_file.c. It should be able to
layer on top of the apr_xml_parser_* functions. See
httpd-2.0/server/util_xml.c for an example of usage.

> (ps.. there might also be a use for a apr_xml_parse_brigade which would 
> convert a brigade into a XML-DOC
> structure for things like SOAP/XSL modules, but I'm not sure )

This would also be quite fine. A slightly smaller utility than file-based
parsing, but handy none-the-less.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message