Hi,
I am using C# to parse some XML which has been generated by another system.
Have loaded data into an XmlDocument and am then using GetElementsByTa gName and SelectSingleNod e to get the XmlNodes I need.
My problem comes when I try to access an empty xml node like this <Field /> (instead of <Field>Some Data Here</Field>).
When getting the data using xmlnode.SelectS ingleNode("Fiel d").FirstChild. Value
I am getting an exception baing raised.
My questions are these.
1. Is there a better way of doing this which can cope with empty fields?
2. If not, can I supress the exceptions without having to use a try-catch block for each node?
Many thanks
I am using C# to parse some XML which has been generated by another system.
Have loaded data into an XmlDocument and am then using GetElementsByTa gName and SelectSingleNod e to get the XmlNodes I need.
My problem comes when I try to access an empty xml node like this <Field /> (instead of <Field>Some Data Here</Field>).
When getting the data using xmlnode.SelectS ingleNode("Fiel d").FirstChild. Value
I am getting an exception baing raised.
My questions are these.
1. Is there a better way of doing this which can cope with empty fields?
2. If not, can I supress the exceptions without having to use a try-catch block for each node?
Many thanks