D
DotNetNewbie
Thanks all for the previous help btw.
What is going on here? It works yet it doesn't want to work in a
loop.
XmlNodeList nodeList = root.SelectNodes(String.Format("/cars/
mfg[@name='{0}'/model]", folderName));
This works:
nodeList[0].ChildNodes[0].Attributes["name"].Value.ToString()
nodeList[0].ChildNodes[1].Attributes["name"].Value.ToString());
but if I try and loop through them I get an error: Expression must
evaluate to a node-set.
my loop:
for (int x = 0; x < nodeList[0].ChildNodes.Count; x++)
{
XmlNode node = nodeList[0].ChildNodes[x];
url = new UrlPattern();
url.Name = node.Attributes["name"].Value.ToString();
url.RegexString = node.Attributes["regexString"].Value.ToString();
url.RealPath = node.Attributes["realPath"].Value.ToString();
url.Format = node.Attributes["format"].Value.ToString();
rgUrlPatterns.Add(url);
}
What is going on here? It works yet it doesn't want to work in a
loop.
XmlNodeList nodeList = root.SelectNodes(String.Format("/cars/
mfg[@name='{0}'/model]", folderName));
This works:
nodeList[0].ChildNodes[0].Attributes["name"].Value.ToString()
nodeList[0].ChildNodes[1].Attributes["name"].Value.ToString());
but if I try and loop through them I get an error: Expression must
evaluate to a node-set.
my loop:
for (int x = 0; x < nodeList[0].ChildNodes.Count; x++)
{
XmlNode node = nodeList[0].ChildNodes[x];
url = new UrlPattern();
url.Name = node.Attributes["name"].Value.ToString();
url.RegexString = node.Attributes["regexString"].Value.ToString();
url.RealPath = node.Attributes["realPath"].Value.ToString();
url.Format = node.Attributes["format"].Value.ToString();
rgUrlPatterns.Add(url);
}