Q
Problem solve Get help with specific problems with your technologies, process and projects.

Remove/ignore empty child nodes before/while parsing

I have created an application which creates as well as parses an XML document and displays the data in different forms. I'm facing a problem when I have to parse an XML document with empty nodes. In this case, I cannot be referencing a particular node using firstChild.firstChild syntax because I may end up in referencing an empty child node. Is there a easy way to remove/ignore empty childnodes before/while parsing?
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.

Dig Deeper on Topics Archive

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchSoftwareQuality

SearchAWS

SearchCloudComputing

TheServerSide.com

Close