Hey Chris Just a thought, what if DocumentFactory had a way of registering a NamespaceContext or a namespace URI Map with it, then you could register your normal namespaces once and never have to worry about such things again.
e.g. if you were to register your preferred namespace URIs with the singleton DocumentFactory, then everthing should see it I think. I`m on the road the moment, having to use pesky internet cafes right now but once I get a real net connection on my laptop I will try experiment with this approach, it could make things *much* easier to use when using namespaces and XPath. BTW point 2) you mention - XPath cannot use namespaces with no prefixes. Or to say that another way, the only way to specify a namespace in an XPath expression is to use a prefix. James FROM: Chris NoklebergDATE: 01/16/2002 15:23:12SUBJECT: [dom4j-dev] Easier namespace xpath handling First, I really like the new setNamespaceURIs feature in CVS. It makes xpath useful again. But, it is still a pain to have to create an xpath, set the mapping, and then execute the xpath, instead of just calling selectNodes, etc., directly on the context node. What I have done to get around this is create my own DocumentFactory which overrides createXPath to always bind the "my" prefix to the namespace URI of the context node. Then I just use "my:" for everything, unless I need a node from a different namespace (which for me is rare). It would be nice if this kind of shortcut were built in. I don't have very good suggestions, though: 1) Reserve a special namespace like "my" or "self" 2) Make unprefixed elements default to the namespace of the context node (but how would you specify the empty namespace?) 3) Add some way of setting a default prefix/namespace mapping for a whole document tree at a time, aside from writing your own DocumentFactory? A setNamespaceURIs method on Node? -- Chris __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev