[
Lists Home |
Date Index |
Thread Index
]
At 11:35 AM +0100 7/11/02, Michael Kay wrote:
>With the following XML document, I get three different results from
>different parsers.
>
><doc xmlns:xml="http://www.w3.org/XML/1998/namespace"/>
>
>Crimson rejects it.
>AElfred accepts it, and doesn't notify the namespace to the SAX2
>ContentHandler.
>Piccolo accepts it, and does notify the namespace to the SAX2
>ContentHandler.
>
>Any opinions on which is right?
>
According to the namespaces spec:
The namespace prefix, unless it is xml or xmlns, must have been
declared in a namespace declaration attribute in either the start-tag
of the element where the prefix is used or in an an ancestor element
(i.e. an element in whose content the prefixed markup occurs). The
prefix xml is by definition bound to the namespace name
http://www.w3.org/XML/1998/namespace. The prefix xmlns is used only
for namespace bindings and is not itself bound to any namespace name.
I see nothing that says it is illegal to declare it. Thus Crimson is wrong.
According to the SAX JavaDoc,
<http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html#startPrefixMapping(java.lang.String,%20java.lang.String)>
There should never be start/endPrefixMapping events for the "xml"
prefix, since it is predeclared and immutable.
Thus Piccolo is wrong. You should report a bug to Piccolo's maintainer.
AElfred is correct.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
|