JJ wrote:
*Hi all,
Im looking for a better way to handle the exeption if you try to find
a
node that doesnt exists?
It usualy breaks in a object exeption.
Now i have to use the try en catch option..
Any other ideas???
thanks in advance
greeting jj *
I too came across this a lot. The strategy I adopted was to use a
foreach(XmlNode in NodeInQuestion.ChildNodes) and use a switch-case to
go through the possible nodenames-this will allow you to work with only
the nodes that you name, and easily refactored to allow for new ones.
Within the foreach you can set some kind of flag that you can later
check to see if a node existed or not.
Of course, if possible, you should always set up a schema and validate
through that but it may not be what you're looking for.
Hope that helps,
Dan'
--
danprime
------------------------------------------------------------------------
Posted via
http://www.mcse.ms
------------------------------------------------------------------------
View this thread:
http://www.mcse.ms/message1880477.html