i've seen various comments on the net regarding xpath's inability to select nodes
from a document with an unnamed default namespace.  this leads to some
pretty non-intuitive behaviour. 

a document like:

<Schema name="whatever" 
        xmlns="urn:schemas-microsoft-com:xml-data"
        xmlns:dt="urn:schemas-microsoft-com:datatypes">

    <foo attr = "1"/>

</Schema>

cannot be queried with an expression like "//Schema/foo@attr" because the first
namespace has no explicit name, it is kindof invisible to xpath.  one can kludge
around this with something like "*//[name()='Schema']/foo@attr", but that's just
wrong!  ;-)

have seen a couple of hacks involving calling setNamespaceURIs, but have been 
unable to get this to work right away, so i figured posting might turn up a better 
solution...

anyway, someone out there was commenting on a general solution involving setting
the URIs in the document's namespace context *automatically* by creating a new 
document factory.  this would be *really* nice because i don't explicitly create any 
XPath objects (i use the convenience methods all over the place instead!).  does 
anyone have code that does this (or perhaps a brief description of how to do it)?

thanks!!

     jon



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code1
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to