// values public static string Value(this xElement element) { if (element == null) { return(null); } return(element.Value); }
// names public static string Name(this xElement element) { if (element == null) { return(null); } return(element.Name); }
internal static T Convert <T>(xElement element, TryParse <T> parser, T defaultValue) { T value; if (element != null && parser(element.Value, out value)) { return(value); } return(defaultValue); }
public static xAttributes Attributes(this xElement element) { if (element == null) { return(sEmptyAttributes); } var attributes = element.XElement.Attributes(); return(new xAttributes(attributes.Select(i => new xAttribute(element._Document, element, i)))); }
public static TEnum AsEnum <TEnum>(this xElement element, TEnum defaultValue) where TEnum : struct { TEnum value; if (element != null && Enum.TryParse(element.Value, true, out value)) { return(value); } return(defaultValue); }
public static xAttributes Attributes(this xElement element, string name) { aError.CheckNull(name, "name"); if (element == null) { return(sEmptyAttributes); } var attributes = element.XElement.Attributes(name); return(new xAttributes(attributes.Select(i => new xAttribute(element._Document, element, i)))); }
// attributes public static xAttribute Attribute(this xElement element, string name) { if (element == null) { return(null); } if (!element.HasAttributes) { return(null); } var attribute = element.XElement.Attribute(name); if (attribute == null) { return(null); } return(new xAttribute(element._Document, element, attribute)); }
internal xObject(xDocument document, xElement parent) { mDocument = document; mParent = parent; }
internal xElement(xDocument document, xElement parent, XElement element) : base(document, parent, element) { mElement = element; }
// explicit casts public static TEnum AsEnum <TEnum>(this xElement element) where TEnum : struct { return(AsEnum(element, default(TEnum))); }
internal xAttribute(xDocument document, xElement parent, XAttribute attribute) : base(document, parent) { aError.CheckNull(attribute, "attribute"); mAttribute = attribute; }