Reading XML subtree

J

Jose Oliver

I am trying to figure out the best approach on reading a
portion of an XML file.

I have the following:

<Employees>

<Employee>
<Name>John Doe</Name>
<Address>...
</Employee>

<Employee>
<Name>Jane Doe</Name>
<Address>...
</Employee>

I only need to read all the child elements below the
<Address> for John Doe.

How can I do this?

- j. oliver
 
P

Peter Rilling

Just load it into an XmlDocument and use an XPath.

It's been a while, but something like "/Employees/Employee[Name = 'John
Doe']/Address/*".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top