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

Hi Daniel,

  No because the code parsing it in xmlParseXMLDecl() does not fire any
SAX event, so any proof of having gone though that path can only be noticed
by the side effects of that routine. It sets ctxt->version, so if you
don't have ctxt->version you can be sure you didn't had an XMLDecl, but
unfortunately I documents are alway created with a version string of 1.0
if no XMLDecl is found, see line 9081 of parser.c

If I submitted a patch to add a hasXmlDeclaration field to the
xmlParserCtxt struct would you consider merging it? :)

(It would also be possible to add a SAX callback to be called when the XML
declaration is parsed, but this seems like overkill for such a small thing
and would require changing the SAX struct which is a bad thing).



Print XML with Prince!

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