xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Clark <an...@apache.org>
Subject Re: Problem with attribute namespaces
Date Sat, 13 Jul 2002 09:21:25 GMT
Brenda Bell wrote:
> Where I'm having a problem is in my handler's startElement 
> implementation.  Seems that attributes(idx).getURI() always returns an 
> empty string.  For an attribute like businessKey, I would have expected 
> the default URI "urn:uddi-org:api".
> Is this a bug in the parser?  Or am I doing something wrong?

This is a common misunderstanding about namespaces and
attributes in XML. Unless attributes are prefixed, they
are NOT in ANY namespace. For example:

   <a:root xmlns:a='NSa' attr1='value1' a:attr2='value2'/>

The "attr1" attribute is not in any namespace whereas the
"attr2" attribute is in the "NSa" namespace.

Therefore, what you are seeing is not a bug in any of
the parsers that you are using (unless, of course, that
the parsers *are* returning namespace information for
unprefixed attributes). Namespaces in XML is just
defined to be this way.

Andy Clark * andyc@apache.org

In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message