On Tue, Nov 15, 2005 at 11:17:05AM +1100, Michael Day wrote: > > Hi, > > The xmlReaderTypes enumeration contains this value: > > XML_READER_TYPE_XML_DECLARATION > > However it seems that this value is never returned to the caller, and it > does not seem to be used anywhere in the libxml2 code.
I think we matched microsoft XMLReader behaviour on this. > Is it possible to tell whether or not an <?xml...?> declaration was parsed > when using the xmlReader? if there is a doc->encoding or doc->standalone != -1 then there was a declaration for sure, but otherwise one just can't tell. > (There is a function to get the XML version number from the current > document; if that returns NULL, does it indicate that there was no XML > declaration parsed?) > > If not, is it possible to tell when using the SAX parser? 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 Daniel -- Daniel Veillard | Red Hat http://redhat.com/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
