Not sure which other XPath expressions you used but the comment is a child of ROOT so 
/ROOT/comment() should work.  Hope that helps.

Marty

-----Original Message-----
From: Barry Andrews [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 11:02 PM
To: [EMAIL PROTECTED]
Subject: [dom4j-user] Selecting sibling comment nodes using XPath


Hi dom4j users,
    I am having a bit of trouble selecting comment nodes that are attached 
to the root element, i.e. siblings of other nodes. My tree looks like this:
<ROOT>
    <AAA/>
    <!-- My Comment node -->
    <BBB/>
</ROOT>

I want to get the comment node that is between nodes AAA and BBB. I have tried:
List list = m_Doc.selectNodes("/ROOT/AAA/following-sibling::*"); which just 
selects the BBB nodes and skips the comment node.
and I also tried:
List list = m_Doc.selectNodes("/ROOT/AAA/comment()"); which doesn't select 
anything.

I have also experimented with other XPath expression which unfortunately 
also do not work. The only way I get comment() function to work is if the 
comment node is a child of AAA or BBB.

If anyone can tell me how this can be done, I will truly appreciate it!


many thanks,


Barry



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user 
  
NOTICE: This E-mail may contain confidential information. If you are not 
the addressee or the intended recipient please do not read this E-mail 
and please immediately delete this e-mail message and any attachments 
from your workstation or network mail system. If you are the addressee 
or the intended recipient and you save or print a copy of this E-mail, 
please place it in an appropriate file, depending on whether 
confidential information is contained in the message. 
 
 
ą^){([~y*x~z+-ZԨ~ਝjvzg,}xvq[܆)qZn)b'jwZqZ~tZ+ky/jXm
)zǜozǿ 
٥vf)+-vX(~zwilqzlX)ߣh

Reply via email to