> So, logically <details xmlns="" is applying the default namespace for > its children. Therefore, its children should be dependent on it > supplying this default namespace. If it were to no longer supply this > default namespace, then the children would logically default to the > xhtml namespace. Also, if you were to take this XML document and change > <details xmlns=""> to <details xmlns="urn:blah.com:blah"> and reparse > the document then of course the children are now in the new default > namespace. I am of the opinion that if you were to programatically > change the namespace on this nodes, that it's completely logical that > you'd have the same end result and that the descendant nodes would > inherit the new namespace.
I agree that programmatically this could be a valid implementation of the default namespace problem and might be a solution that could be implemented for dom4j. > 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) > In regard to me disagreeing with Edwin's statement that attributes must > be specifically declared in a namespace. I'd quote the XML spec in > saying, "Default namespace declarations do not apply directly to > attribute names; the interpretation of unprefixed attributes is > determined by the element on which they appear." My interpretation of > this is that default namespaces don't apply DIRECTLY to, but they can > apply indirectly to attributes. The attribute has the same namespace as > the element unless specified otherwise, and there's no reason that the > element couldn't be using the default namespace in scope. In regard to > the quote, I believe that "The namespace name for an unprefixed > attribute name always has no value." does not imply that the attribute > has no namespace, but that it has no "namespace name" which I believe > must have different meaning. I understand your position, however this is simply not the interpretation that has been used by the common XML standards like: XPath, DOM, SAX and implementations like dom4j, XOM or JDOM. Regards, Edwin -- http://www.edankert.com/ ------------------------------------------------------------------------- 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