Q

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.
This was first published in January 2004

Dig deeper on XML and XML schema

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

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.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close