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

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Jun 2 13:07:39 PDT 2001

At 2:19 PM -0500 6/2/01, philip.nelson at omniresources.com wrote:
>I wanted to move this discussion to a different thread.  Elliotte is
>correct, this is worrysome.  These issues would affect JDOM if you tried to
>write a processor for these types of documents.  So for discussion if
>anybody is interested.....
>There are increasing cases where a prefix will be used out of context of the

NO! I don't believe such cases exist. There is always a context!  I'm 
not familiar with WSDL but let's look at the other two. I'll show you 
exactly what the context is and what URI it assigns:

>	<some-xsl-element xmlns:foo="http://foo.org/">
>		<value-of select="foo/bar/foo:baz"/>
>	</some-xsl-element>

In this case the value-of element is inside the some-xsl-element. It 
is in the control of the context of that element. The foo prefix is 
mapped to the URI http://foo.org/

>XML Schema
>	<anElement type="xsd:float" />

In this case this would actually appear inside a larger schema like this:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"


   <xsd:Element type="xsd:float" />


The context is provided by the root element. It bhinds the prefix xsd 
to the namespace URI http://www.w3.org/2000/10/XMLSchema.

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.

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.

| 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