xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bray <tb...@textuality.com>
Subject Re: Namespaces Question...
Date Sun, 20 Feb 2000 22:21:15 GMT
At 09:51 PM 2/19/00 -0800, Pierpaolo Fumagalli wrote:
><document xmlns="http://www.betaversion.org/document"
>          xmlns:pier="http://www.betaversion.org/~pier/nsdecl">
>  <pier:testelement value="somevalue"/>
></document>
>
>I wanted to know what namespace URI the "value" attribute has...
>- is it the empty string ""?
>- is it the "pier" namespace "http://www.betaversion.org/~pier/nsdecl"?
>- is it the default namespace "http://www.betaversion.org/document"?

The attribute "value=" is not in any namespace.  An API could choose to 
signal this with either a null value or an empty string, (the latter works 
since the empty string can never be a legal namespace name), or by other
methods including exceptions and return code with side effects depending 
on your programming language and religion.   I prefer the empty string 
because in Java you can always say

 if (ns.equals(whateverNamespaceICareAbout))

instead of 

 if ((ns != null) && ns.equals(whateverNamespaceICareAbout))

 -Tim

Mime
View raw message