public XmlDocument(DefaultNsBehaviourEnum defaultNsBehaviour) { DefaultNsBehaviour = defaultNsBehaviour; if (DefaultNsBehaviourEnum.Name == defaultNsBehaviour) { DefaultNsPrefix = DEFAULT_DEFAULT_NS_PREFIX; } }
private System.Xml.XmlNamespaceManager CreateNamespaceMgr(DefaultNsBehaviourEnum defaultNsBehaviour, string prefixForDefaultNS) { if (DefaultNsBehaviourEnum.Remove == defaultNsBehaviour) { base.InnerXml = System.Text.RegularExpressions.Regex.Replace(base.InnerXml, "xmlns=\"[^ ]*\" ", ""); } System.Collections.Specialized.NameValueCollection namespaces = GetNamespaces(base.DocumentElement, prefixForDefaultNS ?? ""); System.Xml.XmlNamespaceManager namespaceMgr = null; if (0 != namespaces.Count) { namespaceMgr = new System.Xml.XmlNamespaceManager(base.NameTable); for (int i = 0; i < namespaces.Count; i++) { namespaceMgr.AddNamespace(namespaces.Keys[i], namespaces[i]); } } return(namespaceMgr); }