Quick way to check if an element exists?
I'm reading through all my xml elements. The structure is consistent between
all the children so it is easy to just go read in anything. In some cases
I add an additional element. If the element exists, I want to do something
different. The code looks like this:
Set node = item.selectSingleNode("description")
Then I use node.Text in some other functions. However, I do not see an easy
way to see setting the node has failed. Basically I can think of 3 options:
1) Make the structure consistent in all children, then check if the text
is "" or contains significant data.
2) Add error handling to blast through any problems and call different functions
if an error occurs, which indicates no element. I don't like this option
at all - kind of a major hack that leads to sloppy coding.
3) Create a function that goes through all children checking for a particular
element. I guess this would be the best option, but is this built into the
msxml parser? It seems like I shouldn't have to write this myself, that it
should be part of the parser and maybe I just don't see it.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center