Edwin Dankert wrote:
>> 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.
>
> Sorry about the misunderstanding.
>
> I am not too sure about this solution, it doesn't seem to be very
> transparent. It might work in 99% of the cases but it just doesn't
> seem right to implement a specific case for a default namespaces on a
> root-node.
I'm not suggesting a special case for the root node, just that 
unspecified XPath expressions default to something other than "".  Such 
as the _context node_'s namespace(not necessarily the root node).
A co-worker pointed out something that made me rethink using the context 
node's namespace as the default.  The instance in which you have:
<div>
    <svg:blah></svg:blah>  
    <a href="blah">blah</a>  
    <p>blah, blah</p>
</div>

If the svg:blah tag is the context node, it may be more intuitive to use 
the default namespace defined in the scope of the context node for the 
XPath evaluation.   But, this specific doesn't really concern me as it 
would rarely be an issue, and just something to remember.  I could see 
merit both ways.

>
>> 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>
>
> The 'child' element in this case is not in the default namespace,
> actually it is in no namespace, this is what xmlns="" does, I am not
> sure what you find to be weird about this?
A better example of what I find weird would be that if you have an 
entire document that is in the xhtml namespace and then one node that is 
in the "" namespace, then any, 'normal' xpath expressions.(ones without 
namespace specification.  eg: //[EMAIL PROTECTED]'blah']  would ONLY consider 
the one that has no namespace and would skip over all the standard xhtml 
document tags.


>
> Regards,
> Edwin


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