Patrizio,xmlns:myns="xxx" associates the namespace xxx to all descendent elements that have the prefix myns.
xmlns="xxx" associates the namespace xxx to all descendent elements that don't have a prefix.
hope it helps. paulLe 04-juil.-08 à 17:09, <[EMAIL PROTECTED]> <[EMAIL PROTECTED] > a écrit :
I'm trying to understand better the namespace topic. If I've a document like below: [DOC1] <myns:books xmlns:myns="http://something"> <book> <year>2007</year> </book> <book> <year>2008</year> </book> </myns:books>if I want access book elements with xpath expression I should use / myns:books/book and not /myns:books/myns:book (I've used XMLSpy).So I deduce that book elements don't have a namespace or is 'empty'.If I want to have myns as namespace for all elements, my document should appear as below:[DOC2] <myns:books xmlns:myns="http://something"> <myns:book> <myns:year>2007</myns:year> </myns:book> <myns:book> <myns:year>2008</myns:year> </myns:book> </myns:books>I mean, should I tag each element with namespace as in [DOC2] or like in [DOC3] there is an equivalent 'short' form ?[DOC3] <books xmlns:myns="http://something"> <book> <year>2007</year> </book> <book> <year>2008</year> </book> </books>It seems that [DOC2] & [DOC3] are different because /myns:books/ myns:book xpath expression is correct for [DOC2] but not for [DOC3].Could anyone help me to understand better this topic ?
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________ dom4j-dev mailing list dom4j-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-dev