D
Dahak
It seems that my GoogleFu has failed me tonight and I'm hoping I
can find some advice.
I've inherited a ASP.NET project written in Visual Basic.
I'm not too familiar with the .NET framework or XML, so bear with
me.
The project is about 95% complete, but the XML parser needs quite
a bit of tightening.
One early problem I had was having the script crash when
attempting to access an XmlTextReader node that didn't exist. I've
since learned to check to see if the node IS NOTHING to prevent an
actual read attempt on the non-existent node.
My current troubles happen when trying to deal with a node that
may - or may not - have multiple elements. For instance, there may be
one or more //ShipTo/Address/PostalAddress/DeliverTo elements.
I know that when there is _one_ element, I can access the node
with doc.SelectSingleNode(//Node/Path).InnerText.
I know that when there is _more than one_ element, I can access
the node with doc.SelectSingleNode(//Node/Path).Item(x).InnerText.
But how do I properly test for the element node having a single or
multiple values?
I don't recall having any success with
doc.SelectSingleNode(//Node/Path).Item(0).InnerText when the node
wasn't actually a list.
Any thoughts would be appreciated.
Thanks.
-Joe
can find some advice.
I've inherited a ASP.NET project written in Visual Basic.
I'm not too familiar with the .NET framework or XML, so bear with
me.
The project is about 95% complete, but the XML parser needs quite
a bit of tightening.
One early problem I had was having the script crash when
attempting to access an XmlTextReader node that didn't exist. I've
since learned to check to see if the node IS NOTHING to prevent an
actual read attempt on the non-existent node.
My current troubles happen when trying to deal with a node that
may - or may not - have multiple elements. For instance, there may be
one or more //ShipTo/Address/PostalAddress/DeliverTo elements.
I know that when there is _one_ element, I can access the node
with doc.SelectSingleNode(//Node/Path).InnerText.
I know that when there is _more than one_ element, I can access
the node with doc.SelectSingleNode(//Node/Path).Item(x).InnerText.
But how do I properly test for the element node having a single or
multiple values?
I don't recall having any success with
doc.SelectSingleNode(//Node/Path).Item(0).InnerText when the node
wasn't actually a list.
Any thoughts would be appreciated.
Thanks.
-Joe