CSharp examples for System.Xml:XML Node
Reads a true false value from XmlNode
using System.Xml; using System.Text; using System.Collections.Generic; using System;/*from w w w .j a va 2s . co m*/ public class Main{ /// <summary> /// Reads a true/false value /// </summary> /// <param name="xNode"></param> /// <param name="attributeName"></param> /// <param name="defaultValue"></param> /// <returns></returns> internal static string ReadTextAttribute(XmlNode xNode, string attributeName, string defaultValue = "") { var attribute = xNode.Attributes[attributeName]; if (attribute == null) { return defaultValue; } return attribute.Value; } }