I am trying to read all orders element, which have the attribute
Phase="Reorganize". I am using the following code on the xml document.
private void LoadPhase (XmlDocument Doc, TreeNode Parent, Phase OrderPhase)
{
XmlNodeList Nodes =
Doc.SelectNodes("/OrderFile/Orders/Order[@Phase='Reorganize']");
foreach (XmlElement Node in Nodes)
{
string S = Node.InnerText;
}
}
<?xml version="1.0" encoding="utf-8"?>
<OrderFile Version="1.0">
<Orders>
<Order Phase="Reorganize">DA-(1)
<PhaseError>I dont want this text</PhaseError>
</Order>
<Order UniqueId="1" Phase="Politics">DPR-(2)</Order>
</Orders>
</OrderFile>
My problem is that the Node.InnerText gives me all the following test
"DA-(1)<PhaseError>I dont want this text</PhaseError>, What I need is the
"DA-(1)" part.
How do only read the current elements value and not all it childs nodes?
I checked all the properties of the Node using the debugger, but apparently
none of them contains only the element own value
Michael Søndergaard