[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Declaring the XML namespace


how to declare in xml
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@m... | 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/    |
+----------------------------------+---------------------------------+

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.