Re: [xml] SAX2 / empty namespace issue



On Wed, Jun 15, 2005 at 04:29:57PM +1000, Michael Day wrote:

Hi,

I receive an error when parsing the following document with
libxml2-2.6.19:

<foo xmlns:null=""/>
foo.xml:1: error: Empty namespace name for prefix null

However, this error is not passed to any handler that I install using
xmlSetStructuredErrorFunc, even though other errors are.

It also seems that this error causes libxml2 to crash on Windows (although
not on Linux) when a structured error handler has been set.

Does anyone have any insight into this issue?

  Strange, it's not the behaviour I'm seeing here with 2.6.19 or CVS head:

paphio:~/XML -> xmllint tst.xml
tst.xml:1: parser warning : xmlns:null: '' is not a valid URI
<foo xmlns:null=""/>
                  ^
<?xml version="1.0"?>
<foo xmlns:null=""/>
paphio:~/XML -> python
Python 2.3.4 (#1, Feb  2 2005, 11:44:49)
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import libxml2
doc = libxml2.readFile("tst.xml", None, 0)
tst.xml:1: parser warning : xmlns:null: '' is not a valid URI
<foo xmlns:null=""/>
                  ^


 to me the parser which is used by xmlReadFile catch the empty namespace
name before it gets at the SAX2.c layer. It still generates a namespace
though:

paphio:~/XML -> /usr/bin/xmllint --debug tst.xml
tst.xml:1: parser warning : xmlns:null: '' is not a valid URI
<foo xmlns:null=""/>
                  ^
DOCUMENT
version=1.0
URL=tst.xml
standalone=true
  ELEMENT foo
    namespace null href=
paphio:~/XML ->

  I ran xmllint though valgrind on that example without trouble too.
  Try to make sure you're using the recent xmlReadxxx API call, maybe
you're using the older SAX1 behaviour which get less testing those days.

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]