Hi all,
 
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 ?
 
Thanks
Patrizio
 


IMPORTANT:
This e-mail transmission is intended for the named
addressee(s)only.
Its contents are private, confidential and protected
from disclosure and should not be read, copied or
disclosed by any other person.
If you are not the intended recipient, we kindly ask
you to notify the sender immediately by telephone
(+41 (0)58 806 50 00), to redirect the message to the
account "[EMAIL PROTECTED]" and to delete this e-mail.
E-mail transmissions may be intercepted, altered or
read by unauthorized persons and may contain viruses.
Therefore, it is recommended that you use regular mail
or courier services for any information intended to be
confidential. However, by sending us messages through
e-mail, you authorize and instruct us to correspond by
e-mail in the relevant matter.
Thank you.
-------------------------------------------------------------------------
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

Reply via email to