Groups | Blog | Home
all groups > dotnet xml > september 2004 >

dotnet xml : XmlNodeList.Count hangs forever...


frandalc NO[at]SPAM swbell.net
9/10/2004 9:41:57 AM
Hi.

I am returning a "distinct" list of nodes from an xmldocument using
selectnodes. I get the list fine, and I can select individual nodes,
but when I try to access the count of the list my computer just hangs.
Also, if I try to iterate the list using foreach the first time works,
and then the second try hangs. I don't have more than about 200 rows
in the xmldocument. Anyone know what's going on? XPath expression and
code below:

pattern = "NewDataSet/Table[not(State =
preceding-ibling::Table/State)]/State";

xmlNodes = xmlDoc.SelectNodes(pattern);

for(g = 0; g < xmlNodes.Count; g++)
{
xNode = xmlNodes[g];
tvLeftPane.Nodes.Add(xNode.InnerText);
}

Martin Honnen
9/11/2004 1:15:44 PM


[quoted text, click to view]


[quoted text, click to view]

There is a typo, it needs to be

pattern =
"NewDataSet/Table[not(State=preceding-sibling::Table/State)]/State";

[quoted text, click to view]

What are you manipulating here? If tvLeftPane.Nodes is part of the same
document then your collection might change inside the loop.


--

Martin Honnen
AddThis Social Bookmark Button