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

Re: [xml] SAX2 / empty namespace issue



On Wed, Jun 15, 2005 at 06:30:15PM +1000, Michael Day wrote:
> 
> Hi Kasimier,
> 
> > Dunno why it crashes, but, as I learned from Daniel, for such a
> > namespace disabling mechanism, XML version 1.1 must be used, since
> > this is allowed only in XML Namespaces 1.1. So maybe it's just the
> > prolog that needs to be adjusted on your side: <?xml version="1.1"?>

  Well it's is a welformed XML-1.0 document. But it is not conformant
to the namespace in XML recommandation. That's why libxml2 parser generates
an error, but not a fatal error in my own experiment. The associated code
in parser.c is:

                uri = xmlParseURI((const char *) URL);
                if (uri == NULL) {
                    xmlWarningMsg(ctxt, XML_WAR_NS_URI,
                         "xmlns:%s: '%s' is not a valid URI\n",
                                       attname, URL);
                } else {
                    if ((ctxt->pedantic) && (uri->scheme == NULL)) {
                        xmlWarningMsg(ctxt, XML_WAR_NS_URI_RELATIVE,
                                      "xmlns:%s: URI %s is not absolute\n",
                                      attname, URL);
                    }
                    xmlFreeURI(uri);
                }

  
> Right, that is true, the XML document is not correct and an error should
> be produced. However, libxml is not giving me one, which is really what I
> am interested in :)

  it does, but I suspect you're using the parser in the old SAX1 compatibility
mode, i.e. the xmlParsexxx instead of xmlReadxxx entry points.
  
> Since reporting the issue I have done some testing with valgrind and
> confirmed that it does appear to be a libxml issue, with an incorrect
> memory access in xmlParserError that is presumably leading to the crash on
> Windows and the failure to receive an error message on Linux.

  What API entry point are you using. xmllint does not follow that behaviour.

> I'm not sure exactly what is wrong with the code though; the libxml error
> handling system is a little bit scary for the uninitiated :)

  well some people want really detailed informations about errors, and those
were added later in the process, so there is multiple reporting layers.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team 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]