public static Uri ToXmlBase(this System.Xml.XmlNode self) { if (self == null) { throw new ArgumentNullException("self"); } var attrib = self.FindAttribute("xml:base"); return((attrib != null && attrib.Value != null) ? new Uri(attrib.Value) : null); }
//public static IMediaType GetAttributeMediaType(this System.Xml.XmlNode self, string name, IMediaTypeFactory mediaTypeFactory) //{ // if (self == null) // throw new ArgumentNullException("self"); // var attrib = self.FindAttribute(name); // return (attrib != null && attrib.Value != null) ? // mediaTypeFactory.GetByCode(attrib.Value) // : null; //} public static Uri GetAttributeUri(this System.Xml.XmlNode self, string name) { if (self == null) { throw new ArgumentNullException("self"); } var attrib = self.FindAttribute(name); return((attrib != null && attrib.Value != null) ? attrib.Value.ToUri() : null); }
public static string GetAttributeString(this System.Xml.XmlNode self, string name) { if (self == null) { throw new ArgumentNullException("self"); } var attrib = self.FindAttribute(name); return(attrib != null ? attrib.Value : null); }
public static ILanguageTag GetAttributeLanguageTag(this System.Xml.XmlNode self, string name) { if (self == null) { throw new ArgumentNullException("self"); } var attrib = self.FindAttribute(name); return(attrib != null? LanguageTag.Parse(attrib.Value) : null); }
public static ILanguageTag ToXmlLang(this System.Xml.XmlNode self) { if (self == null) { throw new ArgumentNullException("self"); } var attrib = self.FindAttribute("xml:lang"); return((attrib != null && attrib.Value != null) ? LanguageTag.Parse(attrib.Value) : null); }
public static int GetAttributeInt32(this System.Xml.XmlNode self, string name) { if (self == null) { throw new ArgumentNullException("self"); } var attrib = self.FindAttribute(name); var number = 0; if (attrib != null) { int.TryParse(attrib.Value, out number); } return(number); }