I am parsing a xml document, I need find out the gid (an attribute) value (3810).
Based on SelectSingleNode()
. I found it is not easy to find the attri
The problem here was they your XPath was all wrong. You had this:
Attributes[AttrDir[@name='EFEM']/AttrDir[@name='Aligner']/AttrDir[@name='SequenceID']/AttrObj[@text='Slot01']]
which would either select or not select the Attributes element depending on whether all the names matched up. This XPath should take you directly to the gid attribute you want:
Attributes/AttrDir[@name='EFEM']/AttrDir[@name='Aligner']/AttrDir[@name='SequenceID']/AttrObj[@text='Slot01']/@gid