当前位置: 首页>>代码示例>>C#>>正文


C# XmlNode.WriteContentTo方法代码示例

本文整理汇总了C#中System.Xml.XmlNode.WriteContentTo方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.WriteContentTo方法的具体用法?C# XmlNode.WriteContentTo怎么用?C# XmlNode.WriteContentTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlNode的用法示例。


在下文中一共展示了XmlNode.WriteContentTo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateHtml5StringFromXml

 /// <summary>
 /// Create a string that could be the contents of an HTML5 file and which corresponds to the specified DOM
 /// (presumed to contain appropriate content).
 /// This method has no business in this class except that it is so parallel to CreateHtml5FromXml that I wanted to keep them together.
 /// </summary>
 /// <param name="dom"></param>
 public static string CreateHtml5StringFromXml(XmlNode dom)
 {
     var output = new StringBuilder();
     using (var writer = XmlWriter.Create(output, GetXmlWriterSettingsForHtml5()))
     {
         dom.WriteContentTo(writer);
         writer.Close();
     }
     return CleanupHtml5(output.ToString());
 }
开发者ID:BloomBooks,项目名称:BloomDesktop,代码行数:16,代码来源:TempFiles.cs

示例2: PrintNodeToConsole

 public static void PrintNodeToConsole(XmlNode node)
 {
     XmlWriterSettings settings = new XmlWriterSettings();
     settings.Indent = true;
     settings.ConformanceLevel = ConformanceLevel.Fragment;
     XmlWriter writer = XmlWriter.Create(Console.Out, settings);
     node.WriteContentTo(writer);
     writer.Flush();
     Console.WriteLine();
 }
开发者ID:BloomBooks,项目名称:BloomDesktop,代码行数:10,代码来源:FluentAssertXml.cs

示例3: WriteNodeContentTo

			public void WriteNodeContentTo (XmlNode node)
			{
				node.WriteContentTo (output);
			}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:4,代码来源:ecma2wiki.cs

示例4: WriteRawContent

 public void WriteRawContent(XmlNode node)
 {
     node.WriteContentTo(_xmlWriter);
 }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:4,代码来源:MamlWriter.cs

示例5: GetIndentInnerXml

        public static string GetIndentInnerXml(XmlNode node)
        {
            MemoryStream m = new MemoryStream();

            XmlTextWriter w = new XmlTextWriter(m, Encoding.UTF8);
            w.Formatting = Formatting.Indented;
            w.Indentation = 4;
            node.WriteContentTo(w);
            w.Flush();

            m.Seek(0, SeekOrigin.Begin);

            StreamReader sr = new StreamReader(m, Encoding.UTF8);
            string strText = sr.ReadToEnd();
            sr.Close();

            w.Close();

            return strText;
        }
开发者ID:renyh1013,项目名称:dp2weixin,代码行数:20,代码来源:DomUtil.cs

示例6: DeserializeObject

        static object DeserializeObject(IFormatter serializer, XmlNode element)
        {
            using (var memoryStream = new MemoryStream())
            using (var xmlDictionaryWriter = XmlDictionaryWriter.CreateTextWriter(memoryStream))
            {
                element.WriteContentTo(xmlDictionaryWriter);
                xmlDictionaryWriter.Flush();
                memoryStream.Position = 0;

                var deserializedObject = serializer.Deserialize(memoryStream);
                return deserializedObject;
            }
        }
开发者ID:bejubi,项目名称:MmapMan,代码行数:13,代码来源:XmlWorkflowInstanceStore.cs

示例7: FormatXml

        public static string FormatXml(XmlNode node)
        {
            String Result = "";

            MemoryStream mStream = new MemoryStream();
            XmlTextWriter writer = new XmlTextWriter(mStream, Encoding.Unicode);

            try
            {
                writer.Formatting = Formatting.Indented;

                // Write the XML into a formatting XmlTextWriter
                node.WriteContentTo(writer);
                writer.Flush();
                mStream.Flush();

                // Have to rewind the MemoryStream in order to read
                // its contents.
                mStream.Position = 0;

                // Read MemoryStream contents into a StreamReader.
                StreamReader sReader = new StreamReader(mStream);

                // Extract the text from the StreamReader.
                String FormattedXML = sReader.ReadToEnd();

                Result = FormattedXML;
            }
            catch (XmlException)
            {
                Result = node.InnerXml;
            }
            writer.Close();

            return Result;
        }
开发者ID:priestofpsi,项目名称:theDiary-Common-Framework,代码行数:36,代码来源:Utility.cs

示例8: CreateHtm5FromXml

        public static TempFile CreateHtm5FromXml(XmlNode dom)
        {
            var temp = TempFile.TrackExisting(GetHtmlTempPath());

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.CheckCharacters = true;
            settings.OmitXmlDeclaration = true;//we're aiming at normal html5, here. Not xhtml.
            //CAN'T DO THIS: settings.OutputMethod = XmlOutputMethod.Html;

            using (var writer = XmlWriter.Create(temp.Path, settings))
            {
                dom.WriteContentTo(writer);
                writer.Close();
            }
            //now insert the non-xml-ish <!doctype html>
            File.WriteAllText(temp.Path, "<!DOCTYPE html>\r\n" + File.ReadAllText(temp.Path));

            return temp;
        }
开发者ID:JohnThomson,项目名称:testBloom,代码行数:20,代码来源:TempFiles.cs


注:本文中的System.Xml.XmlNode.WriteContentTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。