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

philip.nelson at omniresources.com philip.nelson at omniresources.com
Sat Jun 2 12:19:45 PDT 2001


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
uri.

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

WSDL
	  <binding name='AddrBookSoapBinding' type='wsdlns:AddrBookSoapPort'
>

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

How would we decode the prefix to a uri in JDOM?  In JDOM is the only way to
figure it out by a full traversal of the document? The Namespace class is of
no help, nor can it be because the mappings are static and you could have

xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"

You can apparently do this

<?xml version="1.0" ?>
	<yyy:root xmlns:yyy="urn:foo" >
	<yyy:body xmlns:yyy="urn:bar" />
</yyy:root>

What uri is the correct uri for prefix yyy?  In this example, yyy could be
replaced by multiple versions of xsd with different uri.  

So Elliotte is correct, this is worrysome.  But it is there.  In the schema
example, the processor may determine to go to the root element to find the
uri it needs.  Without an application specific agreement about where to look
for namespace declarations, it seems to me that there is a *potential* for
ambiguous meanings for the prefix.  



More information about the jdom-interest mailing list