Re: [ADVANCED-DOTNET] coding against missing xml nodes/attributes

2008-06-06 Thread Peter Vertes
string myAttribute = String.Empty; if (configNode.Attributes["someAttribute"] != null) { myAttribute = configNode.Attributes["someAttribute"].Value; } or to be safer you could use: if (configNode.Attributes["someAttribute"] != null && !String.IsNullOrEmpty(configNode.Attributes["someAttribute

Re: [ADVANCED-DOTNET] coding against missing xml nodes/attributes

2008-06-06 Thread Smotrisky, Alex
against missing xml nodes/attributes string myAttribute = null; XmlAttribute someAttribute = configNode.Attributes["someAttribute"]; if (someAttribute != null) myAttribute = someAttribute.Value; Hope this helps, //p On Fri, Jun 6, 2008 at 9:19 PM, Smotrisky, Alex <[EMAIL PROT

Re: [ADVANCED-DOTNET] coding against missing xml nodes/attributes

2008-06-06 Thread Paulo Mouat
string myAttribute = null; XmlAttribute someAttribute = configNode.Attributes["someAttribute"]; if (someAttribute != null) myAttribute = someAttribute.Value; Hope this helps, //p On Fri, Jun 6, 2008 at 9:19 PM, Smotrisky, Alex <[EMAIL PROTECTED]> wrote: > I've got an object called configNode