I suggest you may need to revisit your algorithmic approach. In situations where nodes may or may not exist, it is always cumbersome to navigate node to node. You might want to consider using XPath expressions to gather sets of nodes into nodelists and process these.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.