Hello,
Let's say I have the following XML...
<?xml version="1.0" standalone="no" ?>
<DataItem xmlns="http://abc.com/xmlA">
<Status>ABC</Status>
<ReturnList xmlns="http://abc.com/xmlBB">
<ListA>
<ListItem>
<ItemType code="F">Item F</ItemType>
<Score>123</Score>
</ListItem>
<ListItem>
<ItemType code="G">Item G</ItemType>
<Score>456</Score>
</ListItem>
<ListItem>
<ItemType code="H">Item H</ItemType>
<Score>789</Score>
</ListItem>
<ListItem>
<ItemType code="I">Item I</ItemType>
<Score>999</Score>
</ListItem>
</ListA>
</ReturnList>
</DataItem>
I would like to get the Listitem that has a code of "G". What would be the
proper XPATH to get that? Here is what I have done so far:
XmlDocument doc = new XmlDocument();
doc.Load("file.xml");
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("aa", "http://abc.com/xmlA");
nsmgr.AddNamespace("bb", "http://abc.com/xmlBB");
XmlElement el = doc.DocumentElement;
Do I have to get the ReturnList Node first before searching for the specific
ListItem?
Thanks in advance!
cj