1

I have an XML Document that specifies certain data instead data nodes like so:

<data type= "arbitrary value">Value</data>

I need to be able to look through this document and select the above node.

XmlNode node = xmlDoc.SelectSingleNode(data[contains(.,'arbitrary value')]);

The above statement does not work.

How can I find nodes with a certain "type"?

Kyle Uithoven
  • 2,414
  • 5
  • 30
  • 43

1 Answers1

1

The xpath data[@type='arbitrary value'] will select all "data" nodes with a type attribute containing the text "arbitrary value"

So:

XmlNode node = xmlDoc.SelectSingleNode("data[@type='arbitrary value']")
Jamiec
  • 133,658
  • 13
  • 134
  • 193