You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ian Holsman <ia...@cnet.com> on 2001/08/03 04:52:39 UTC

Any interest in a apr_xml_parse_file ?

hi.

Just wondering if there is any interest in implementing a apr_xml 
function which will convert
a file into a apr_xml_doc**  


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

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

..Ian

(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 )


Re: Any interest in a apr_xml_parse_file ?

Posted by Luke Kenneth Casson Leighton <lk...@samba-tng.org>.
yes please on the xml parsing!

On Mon, Aug 06, 2001 at 05:44:12PM -0700, Greg Stein wrote:

> 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)

xml is deliberately very specific.  errors, therefore,
are not tolerated.  what happens if someone decides to send a bad
TCP packet?  it's rejected.  same thing.

luke

Re: Any interest in a apr_xml_parse_file ?

Posted by Greg Stein <gs...@lyra.org>.
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/