Re: [xml] Parsing <?xml decl with xmlReader



On Wed, Nov 16, 2005 at 03:22:03PM +1100, Michael Day wrote:

Hi Daniel,

  No because there is already too much cruft in it. But adding a special
value to ctxt->standalone (-2) indicating that the XMLDecl was read but
the standlone information was not present would be okay.

Excellent idea!

That should be as simple as adding the following line near the start of
xmlParseXMLDecl, eg. on line 8902 of parser.c:

    ctxt->input->standalone = -2;

This will be overwritten later if an actual standalone pseudo-attribute is
found in the XML declaration.

Then it is possible to check if the document has an XML declaration simply
by checking that doc->standalone != -1:

    standalone = 1            standalone="yes"
    standalone = 0            standalone="no"
    standalone = -1           no XML declaration
    standalone = -2           XML declaration but no standalone attr

Does this all sound reasonable? If so, should I submit the above line as a
patch?

  yes it's what I suggest, it shoudl work, test it and send the patch :-)

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]