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




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?

Best regards,

Michael

-- 
Print XML with Prince!
http://www.princexml.com



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