dkim18
asked on
Check for xmlnodelist != null not enouhg?
Do I also need to check for how XmlNodeList it brought back form my selectNodes() method?
I only checked the not node but my xml file has no record of <titles><yyyy> on this iteration. why would secondaryTitles != null fail?
My code enters that if statement.
Do I need to check for .count = 0 property too?
foreach (XmlNode element in elements)
{
XmlNodeList secondaryTitles = element.SelectNodes("title s/yyyy"); <===
if (secondaryTitles != null) <=== count is 0 and the code enters here
{
foreach (XmlNode node in secondaryTitles)
{
doing somehting here
}
}
}
I only checked the not node but my xml file has no record of <titles><yyyy> on this iteration. why would secondaryTitles != null fail?
My code enters that if statement.
Do I need to check for .count = 0 property too?
foreach (XmlNode element in elements)
{
XmlNodeList secondaryTitles = element.SelectNodes("title
if (secondaryTitles != null) <=== count is 0 and the code enters here
{
foreach (XmlNode node in secondaryTitles)
{
doing somehting here
}
}
}
ASKER
When I debug it and check the line I am no on yet, the count property of the xmlnodelist has value already.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER