private static string GetNamespaceCore(DomElement element, string prefix) { if (string.IsNullOrEmpty(prefix)) { return(element.Attribute("xmlns")); } return(element.Attribute("xmlns:" + prefix)); }
public static DomElement SetDefaultXmlns(this DomElement self, DomNamespace ns) { if (self is null) { throw new ArgumentNullException(nameof(self)); } return(self.Attribute("xmlns", ns)); }
void CopyAttributes(XmlReader reader, DomElement element) { if (reader.HasAttributes && reader.MoveToFirstAttribute()) { do { element.Attribute(reader.Name, reader.Value); } while(reader.MoveToNextAttribute()); reader.MoveToElement(); } }
public static DomElement SetXmlns(this DomElement self, string prefix, DomNamespace ns) { if (self is null) { throw new ArgumentNullException(nameof(self)); } if (ns is null) { throw new ArgumentNullException(nameof(ns)); } if (string.IsNullOrEmpty(prefix)) { throw new NotImplementedException(); } return(self.Attribute($"xmlns:{prefix}", ns)); }