[lxml-dev] xml:space and xml:lang problem

Kasimier Buchcik K.Buchcik at 4commerce.de
Wed Feb 22 16:45:24 CET 2006


Hi,

On Wed, 2006-02-22 at 08:39 +0100, Stefan Behnel wrote:
> Scott Haeger wrote:

[...]

> > Test.xml is the following:
> > 
> > <?xml version="1.0"?>
> > <svg
> >     xmlns:xml=" http://www.w3.org/1998/XML">
> > <a id="first" xml:space="default"></a>
> > </svg>

[...]

I don't know if this is just a typo in the example, but the
namespace-URI begins with a space-character:
<svg xmlns:xml=" http://www.w3.org/1998/XML">

$ xmllint --debug xmlns.xml
xmlns.xml:2: namespace error : xml namespace prefix mapped to wrong URI
<svg xmlns:xml=" http://www.w3.org/1998/XML">
                                            ^
DOCUMENT
version=1.0
URL=xmlns.xml
standalone=true
namespace xml href=http://www.w3.org/XML/1998/namespace
  ELEMENT svg
    TEXT interned
      content=
    ELEMENT a
      ATTRIBUTE id
        TEXT
          content=first
      ATTRIBUTE space
        TEXT
          content=default
    TEXT interned
      content=

[...]

> """
> The prefix xml is by definition bound to the namespace name
> http://www.w3.org/XML/1998/namespace.
> """
> 
> Source: http://www.w3.org/TR/REC-xml-names/


[...]

Just an info: Libxml2 strips all explicit declarations of the XML
namespace, since it stores the XML ns-declaration in a special field on
the doc itself, namely in xmlDoc->oldNs. The XML namespace declaration
is "built-in" by every XML processor, so you don't have to declare it.

Regards,

Kasimier


More information about the lxml-dev mailing list