David,

Node node = doc.selectSingleNode( "/slideshow/@title" );

or

Attribute attr = (Attribute) doc.selectSingleNode( "/slideshow/@title" );

Silvain

----- Original Message -----
From: David Thielen
To: [EMAIL PROTECTED]
Sent: Wednesday, February 13, 2002 20:12
Subject: [dom4j-user] xpath selectSingleNode to get an attribute


Hi;

If I call:
    Node node = doc.selectSingleNode( "/slideshow[@title]" );

It does not return the attribute for title - it returns the slideshow
element. I then have to do node.valueOf to get the attribute. It seems
logical to me that if I request an attribute in my xpath command, that I
should get the attribute back as the node.

And if I can't do that, is there any easy way to select the attribute part
of an xpath request out? I get these strings from users so I have to parse
it out in this case.

????? - thanks - dave



_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to