XML Node InnerText Wrapper Method


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public string GetNodeText(XmlDocument xmlDoc, string nodeName)
  2. {
  3. if (xmlDoc == null || string.IsNullOrEmpty(nodeName))
  4. return string.Empty;
  5.  
  6. XmlNode node = xmlDoc.GetElementsByTagName(nodeName)[0];
  7.  
  8. if (node == null)
  9. return string.Empty;
  10.  
  11. return node.InnerText;
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.