Edwin Dankert wrote: >> 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. > > I think I understand your concerns. > > At the moment the Jaxen implementation provides default namespace > prefix mappings, based on the namespaces and their prefixes defined on > the context element. (Note: I don't think anybody should rely on this > mechanism, since this would make the code less portable) I do think this affects portability, but are you suggesting that we use xpath such as: //http://www.w3.org/1999/xhtml:html/http://www.w3.org/1999/xhtml:body/http://www.w3.org/1999/xhtml:a ? I'm not even sure this is the right syntax, because you would probably have to escape the colon and /'s within the URLs. If I'm using an xhtml document and only concerning myself with xhtml tags, then why should I care about namespaces, and have an abomination such as this within my code? > > I now think that your reasoning is that if they can do this for the > prefixed namespaces why not also do the same thing for the default > namespace? (I think I agree with this) Again I think you're equating "the default namespace" to "". I would agree that'd it'd be better to be able to setup the namespace map so that if you leave off the namespace, it'd use your mapped one. However, the context is used to decide what the default will be for the expression, so would it not be better to default to the context's namespace or the default namespace within the scope of the context? When I say "the default namespace within the scope of the context" what I'm getting at is: <a xmlns="http://www.w3.org/1999/xhtml"> <b> <c><d /></c> </b> </a>
If <b> is our context, then the default namespace in <b>'s scope is defined by <a> and is "http://www.w3.org/1999/xhtml". So, <b>.selectNodes('c/d') would return <d> because they have the same namespace as the default namespace in <b>'s scope. Jaxen would not return <d> because both <c> and <d> are in the "http://www.w3.org/1999/xhtml" namespace and the xpath expression would default to "", which is a poor choice. > > 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