public static XPathDocument StripNamespaces(IXPathNavigable navigableSet, bool removeDocType) { XPathDocument newXml = null; if (navigableSet == null) { return(newXml); } XPathNavigator node = navigableSet.CreateNavigator(); string xmlString = XmlUtility.StripNamespaces(node.OuterXml, removeDocType); using (StringReader s = new StringReader(xmlString)) { newXml = new XPathDocument(s); } return(newXml); }
public static XPathDocument StripNamespaces(IXPathNavigable navigableSet) { return(XmlUtility.StripNamespaces(navigableSet, false)); }
/// <summary> /// Strip the namespaces from specified <see cref="System.String"/>. /// </summary> /// <param name="xml"> /// The source <see cref="System.String"/>. /// </param> /// <remarks> /// WARNING: Stripping namespaces “flattens” the document /// and can cause local-name collisions. /// /// This routine does not remove namespace prefixes. /// /// </remarks> public static string StripNamespaces(string xml) { return(XmlUtility.StripNamespaces(xml, false)); }