public static XAttribute Attribute_NamespaceSafe(this XElement parent, XName attrName, XNamespace documentDefaultNamespace) { if(attrName.Namespace == documentDefaultNamespace) attrName = attrName.RemoveNamespace(); return parent.Attribute(attrName); }
public static IEnumerable<XAttribute> Attributes_NamespaceSafe(this XElement parent, XName attrName) { if (attrName.Namespace == parent.Name.Namespace) attrName = attrName.RemoveNamespace(); return parent.Attributes(attrName); }