I am iterating through some xml nodes like so.

 

XmlDocument xDoc = new XmlDocument();

MyWebService.ClientService WS = new MyWebService.ClientService();

XmlNode MyData = WS.GetUserInfo();

xDoc.LoadXml(MyData.OuterXml);

XmlNodeList nodes = xDoc.SelectNodes("/Users/User");

            

foreach (XmlNode node in nodes)

{

   switch (node.Attributes["FieldTitle"].Value.Trim())

   {

      case ("Last Name"):

      string nameLast = node.Attributes["LastName"].Value;

   }

}

 

The thing is I would like to check to see if there is a "Last Name 2"
attribute in the XML before iterating.

 

Is there a way to just check for a "FieldTitle" named "Last Name 2" and then
choose what path my code should take based up it's value?

 

Thanks,

Greg

 

 

 

 

Reply via email to