I want to read a certain XmlNode from a XmlTextReader. My file looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<data>
<legend>
<element>
<tag> aqua </tag>
...
while the "aqua" text is surrounded by "/r/n". So I tried to read it somehow like:
dataNode.SelectNodes("//legend/element").where("Tag".Trim() == "aqua");
of course this is just scrap and not working so I need the right one.
Can someone name the right XPath pattern ?
As an XPath 1.0 expression I think you want //legend/element[tag[normalize-space() = 'aqua']]
. That selects element
elements that have a tag
child elements whose normalized string value is aqua
.