/// <summary> /// Returns an <see cref="System.Xml.XmlNamespaceManager"/> /// with respect to the scope element of the specified node. /// </summary> /// <param name="XpNode"> /// The <see cref="System.Xml.XPath.XPathNavigator"/> node. /// </param> public static XmlNamespaceManager GetNamespaceManager(XPathNavigator XpNode) { XmlNamespaceManager nsman = new XmlNamespaceManager(XpNode.NameTable); IDictionary<String, String> names = XpNode.GetNamespacesInScope(XmlNamespaceScope.Local); foreach (KeyValuePair<String, String> kv in names) { nsman.AddNamespace(kv.Key, kv.Value); }
return nsman;
}