I have a method that generates an string in XML format and passes it to be
processed. The string is in the following format:
<grandparent>
<parent>
<child1>text</child1>
<child2>text again</child2>
</parent>
<aunt>
<cousin1>text</cousin1>
<cousin2>text2</cousin2>
<cousin3>text4</cousin3>
</aunt>
</grandparent>
string xmlInput = <values above>
XPathDocument xpDoc = new XPathDocument(new StringReader(xmlInput));
XPathNavigator xpNav = xpDoc.CreateNavigator();
//move to root element <grandparent>
xpNav.MoveToRoot();
xpNav.MoveToFirstChild(); //move to <parent>
xpNav.MoveToFirstChild(); //move to <child1>
strChild1 = xpNav.Value;
xpNav.MoveToNext(); //move to <child2>
strChild2 = xpNav.Value;
.....
The problem I am having is that the xpNav.Value keeps concatenating every
other value onto itself. So instead of having:
strChild1 = "text";
and
strChild2 = "text again";
as I expect, I am getting the following:
strChild1 = "texttextagain";, etc.
Can anyone give me any ideas as to what I am doing wrong and how I might be
able to fix it?
Thanks for your help,
Ron
--
--------------------------------------------------------------
Ron Rodenberg
Lead Software Engineer
Razorvision Technology
8080 N. Central Expressway
Suite 400
Dallas, TX 75206