System.Xml.Xsl.Runtime.XsltFunctions.OuterXml C# (CSharp) Method

OuterXml() public static method

public static OuterXml ( XPathNavigator navigator ) : string
navigator System.Xml.XPath.XPathNavigator
return string
        public static string OuterXml(XPathNavigator navigator)
        {
            RtfNavigator rtf = navigator as RtfNavigator;
            if (rtf == null)
            {
                return navigator.OuterXml;
            }
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.OmitXmlDeclaration = true;
            settings.ConformanceLevel = ConformanceLevel.Fragment;
            settings.CheckCharacters = false;
            XmlWriter xw = XmlWriter.Create(sb, settings);
            rtf.CopyToWriter(xw);
            xw.Close();
            return sb.ToString();
        }