>> I also believe that the Jaxen has made the same misinterpretation which
>> led to the implementation assuming the empty namespace when no namespace
>> is specified.  As much as I wish the XPath docs stated what the default
>> namespace for XPath processing should be, I haven't found anything.  I
>> still believe, however, that there is more merit and logic in using the
>> context node's namespace rather than the empty namespace, and that there
>> is no specification backing for using the empty namespace as the default
>> namespace.
>>     
>
> I disagree with this, the idea is that your code should not have to
> change when your data changes.
>
> <test:root xmlns:test="urn:blah.com:blah">
>   <test:child>text</test:child>
> </test:root>
>
> <root xmlns="urn:blah.com:blah">
>   <child>text</child>
> </root>
>
> The above 2 trees are equivalent and you should be able to use the
> same xpath expression to interrogate both these xml trees.
>
> Also, the namespace-prefix has only been created to facilitate the
> mapping of the namespace name in a XML document, this would otherwise
> be extremely difficult using simple textual content.
>
> Note: I actually believe that there should be no need to expose the
> prefix programmatically, the only time that a user should want to know
> about or define a prefix for a namespace would be when serialising the
> NodeSet to a XML Document. (I think exposing these methods only causes
> confusion and encourages abuse)
>   
I think you misunderstand what I'm saying.  I'm saying that if the 
context node from either of your examples is the node named 'root'(or 
'test:root'), for an XPath expression 'child', that the default 
namespace for the XPath expression would be "urn:blah.com:blah" instead 
of "" and that it would return the child, since in both cases, the 
namespace for the child node should be "urn:blah.com:blah".  Right now 
with Jaxen, your XPath MUST be 'blah:child' assuming you have "blah" 
mapped to "urn:blah.com:blah".  This seems especially unnecessary when 
the XPath is searching through only one namespace.

The example of what I'd be breaking is that 'child' would not have any 
results against the following case(Right now the child node WOULD be 
returned by Jaxen because non-specified namespaces are ALWAYS assumed to 
be "", which is just weird).  Note that right now this situation could 
occur by changing the namespace of the root element programatically from 
"" to "urn:blah.com:blah".

<root xmlns="urn:blah.com:blah">
 <child xmlns="">text</child>
</root>


--Evan


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to