On Mon, Dec 04, 2006 at 11:11:39AM +1100, Michael Day wrote: > Hi, > > Here is a patch that fixes a minor bug in my earlier patch that enabled > detection of whether an XML declaration was specified. It also adds some > documentation explaining the different values of "standalone": > > standalone=1 ---> standalone="yes" > standalone=0 ---> standalone="no" > standalone=-1 ---> no XML declaration > standalone=-2 ---> XML declaration, but no standalone attribute > > The use case for all this is that I wish to use the XML reader, read up > to the start tag of the root element, and then check the standalone > value in order to see if an XML declaration was seen. This is in order > to do content sniffing between XML and HTML. > > The bug was that standalone was defaulting to -1 instead of -2 in > xmlParseSDDecl, even though if we get to xmlParseSDDecl it means that an > XML declaration has been seen. It was only triggering in situations like > this: > > <?xml version="1.0" ?> > > note the space after the version attribute, which was causing > xmlParseSDDecl to be called, then straight away returning -1, as no > standalone attribute was found. Now it returns -2, indicating that no > standalone attribute was found, but the XML declaration is present.
Okay, this looks clean, I hope this new extra value won't be a problem in existing code, I doubt it will, so I applied the patch and commited it, thanks a lot ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [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
