[jdom-interest] prefixes in attribute values or element conte nt(was the hashcode thread)

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Jun 2 20:33:09 PDT 2001


At 6:07 PM -0500 6/2/01, philip.nelson at omniresources.com wrote:

>You are correct if you say I don't understand XSLT very well, but this
>example (from Bob M.) and your response agree with what I think to be true
>here and in WSDL.  The *application* has a defined context to decode the
>prefix to a uri.
>>

NO! Not the application! The Namespaces in XML specification 
specifies what the context is for the resolution of any namespace 
prefix found in an XML document. There is nothing application 
specific about this. It is and must be the same in all applications 
that adhere to Namespaces in XML.

>>  There is no such thing as a namespace prefix out of context in a
>>  namespace well-formed XML document. We long ago decided that
>>  non-namespace well-formed documents were out of scope for JDOM.
>>
>
>Ah, but an attribute value?  Would that make it non namespace compliant?
>Not from the point of view of the parser, only to the application using the
>attribute.
>

True, but that still doesn't leave any room for doubt about how a 
namespace prefix is resolved and what context is assigned to it.

>>  We do need some straight-forward way of getting the URL assigned to a
>>  namespace prefix, but such a question can only be answered in the
>>  context of a particular element.
>
>All true.  I think the only disagreement then may be if an application has a
>right to specify which element that is.  In your counter to my first WSDL
>example, you wanted to be able to redefine a prefix/uri mapping in the
>element where the attribute value occured.

The application does not have the right to redefine this. It must be 
defined in the way Namespaces in XML specifies. That means that the 
closest ancestor-or-self element that declares the prefix using 
xmlns:prefix wins. There is no other possibility.

XPointer is the exception that proves the rule here. It allows 
namespace prefixes to be defined by xmlns part but only because 
XPointers may appear in things that are not namespace well-formed XML 
documents.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list