本文整理汇总了C#中System.Xml.XmlNode.WriteTo方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.WriteTo方法的具体用法?C# XmlNode.WriteTo怎么用?C# XmlNode.WriteTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.WriteTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetXElement
private XElement GetXElement(XmlNode node)
{
XDocument xDoc = new XDocument();
using (XmlWriter xmlWriter = xDoc.CreateWriter())
node.WriteTo(xmlWriter);
return xDoc.Root;
}
示例2: GetXElement
private static XElement GetXElement(XmlNode node) {
var xDoc = new XDocument();
using (XmlWriter xmlWriter = xDoc.CreateWriter()) {
node.WriteTo(xmlWriter);
}
return xDoc.Root;
}
示例3: XmlConverter
public XmlConverter(XmlNode e)
: this()
{
Contract.Requires(e != null);
e.WriteTo(_writer);
}
示例4: GetXmlFragment
static string GetXmlFragment(XmlNode node)
{
using (var stringWriter = new StringWriter())
using (var xmlFragmentWriter = new XmlFragmentWriter(stringWriter))
{
xmlFragmentWriter.Formatting = Formatting.Indented;
node.WriteTo(xmlFragmentWriter);
return stringWriter.GetStringBuilder().ToString();
}
}
示例5: GetXml
internal static string GetXml(XmlNode node)
{
using (var stringWriter = new StringWriter())
using (var xmlTextWriter = XmlWriter.Create(stringWriter))
{
node.WriteTo(xmlTextWriter);
xmlTextWriter.Flush();
return stringWriter.GetStringBuilder().ToString();
}
}
示例6: Create
/// Standard callback
public object Create(object parent, object configContext, XmlNode section)
{
using (MemoryStream ms = new MemoryStream())
{
using (XmlWriter xw = XmlWriter.Create(ms))
section.WriteTo(xw);
ms.Position = 0;
return ms.ToArray();
}
}
示例7: WriteXmlOutput
private void WriteXmlOutput(XmlNode resultNode, XmlWriter xmlWriter)
{
this.xmlWriter = xmlWriter;
InitializeXmlFile(resultNode);
resultNode.WriteTo(xmlWriter);
TerminateXmlFile();
}
示例8: FormattedXml
private static string FormattedXml(XmlNode node)
{
using (TextWriter textwriter = new StringWriter())
{
XmlTextWriter writer = new XmlTextWriter(textwriter);
writer.Formatting = Formatting.Indented;
node.WriteTo(writer);
return textwriter.ToString();
}
}
示例9: WriteResultFile
public void WriteResultFile(XmlNode resultNode, TextWriter writer)
{
var settings = new XmlWriterSettings();
settings.Indent = true;
using (XmlWriter xmlWriter = XmlWriter.Create(writer, settings))
{
xmlWriter.WriteStartDocument(false);
resultNode.WriteTo(xmlWriter);
}
}
示例10: StudyXmlNode
public StudyXmlNode(XmlNode node)
{
using (TextWriter writer = new Utf8StringWriter())
{
using (XmlWriter xmlWriter = XmlWriter.Create(writer,new XmlWriterSettings(){ConformanceLevel = ConformanceLevel.Fragment}))
{
node.WriteTo(xmlWriter);
}
XmlElementFragment = writer.ToString();
}
}
示例11: GetStream
public static Stream GetStream(XmlNode node)
{
MemoryStream stream = new MemoryStream();
XmlWriter writer = XmlWriter.Create(stream);
node.WriteTo(writer);
writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
return stream;
}
示例12: FormatRawMessage
private static String FormatRawMessage(XmlNode document)
{
var sb = new StringBuilder();
using (var stringWriter = new StringWriter(sb))
using (var xmlTextWriter = new XmlTextWriter(stringWriter))
{
xmlTextWriter.Formatting = Formatting.Indented;
document.WriteTo(xmlTextWriter);
}
return sb.ToString();
}
示例13: FormatXml
private static string FormatXml(XmlNode node)
{
var settings = new XmlWriterSettings();
settings.OmitXmlDeclaration = true;
settings.Indent = true;
settings.IndentChars = " ";
using (var output = new StringWriter())
{
using (var writer = XmlTextWriter.Create(output, settings))
{
node.WriteTo(writer);
}
return output.ToString();
}
}
示例14: WriteXmlNode
void WriteXmlNode (XmlNode node)
{
if (node is XmlDocument)
node = ((XmlDocument) node).DocumentElement;
node.WriteTo (Writer);
}
示例15: WriteNodeTo
public void WriteNodeTo (XmlNode node)
{
node.WriteTo (output);
}