Help Finding Content
-
Hi If My XML is:
<person>
<name>Sue</name>
<email>bob@example.com</email>
</person/><person>
<name>Sue</name>
<email>sue@example.com</email>
</person>In C# if I know bob's name how can I get his email address??? Thank You
-
Hi If My XML is:
<person>
<name>Sue</name>
<email>bob@example.com</email>
</person/><person>
<name>Sue</name>
<email>sue@example.com</email>
</person>In C# if I know bob's name how can I get his email address??? Thank You
You want to use an XPathNavigator[^]. Then use an XPath expression like "//person[name='Bob']/email" to select the email node or "//person[name='Bob']/email/text()" to select the email value. Here's an example that's very close to what you want.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
You want to use an XPathNavigator[^]. Then use an XPath expression like "//person[name='Bob']/email" to select the email node or "//person[name='Bob']/email/text()" to select the email value. Here's an example that's very close to what you want.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
Thanks, but I have solved it by using LINQ