koleto115
asked on
How to select a value of an attribute with XPath?
I have xml like this one:
<DetectorData CollectionID='1'/>
whit XSLT one can get the string value like this:
<xsl:value-of select="DetectorData/@Coll ectionID"/ >
How to get the string value with XPath and c# with similar construction?
node.SelectSingleNode("Det ectorData/ @Collectio nID") .... does this works?
<DetectorData CollectionID='1'/>
whit XSLT one can get the string value like this:
<xsl:value-of select="DetectorData/@Coll
How to get the string value with XPath and c# with similar construction?
node.SelectSingleNode("Det
ASKER
Yes, but is there a simple construction that returns string.Empty?
I don't want to check whether the attribute is there or not...
The dotted notation is very ugly, I hopped that there is a kind of XPath trick to retrieve the attribute value with a single method ...
somthing like node.SelectSingleNode("Det ectorData/ @Collectio nID" ..... something that like that ...
I don't want to check whether the attribute is there or not...
The dotted notation is very ugly, I hopped that there is a kind of XPath trick to retrieve the attribute value with a single method ...
somthing like node.SelectSingleNode("Det
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
node.SelectSingelNode("Det
Should do it.
Regards,
TimCottee