Posted By

Anthony on 01/06/10


Tagged

xml


Versions (?)

XML Node InnerText Wrapper Method


 / Published in: C#
 

  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  

You need to login to post a comment.