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