本文整理汇总了C#中System.Xml.XPath.XPathNavigator.WriteSubtree方法的典型用法代码示例。如果您正苦于以下问题:C# XPathNavigator.WriteSubtree方法的具体用法?C# XPathNavigator.WriteSubtree怎么用?C# XPathNavigator.WriteSubtree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XPath.XPathNavigator
的用法示例。
在下文中一共展示了XPathNavigator.WriteSubtree方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAssemblyWriter
private static XmlWriter CreateAssemblyWriter(string path, XPathNavigator assembly)
{
XmlWriterSettings settings = new XmlWriterSettings { Indent = true };
XmlWriter writer = XmlWriter.Create(path, settings);
writer.WriteStartElement("reflection");
if(assembly != null)
{
writer.WriteStartElement("assemblies");
assembly.WriteSubtree(writer);
writer.WriteEndElement();
}
writer.WriteStartElement("apis");
return writer;
}
示例2: ProcessXPathNavigator
private void ProcessXPathNavigator(XPathNavigator xpathNavigator)
{
try
{
using (StringWriter stringWriter = new StringWriter())
{
using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter, XmlWriterSettings))
{
xpathNavigator.WriteSubtree(xmlWriter);
}
WriteObject(stringWriter.ToString());
}
}
catch (PipelineStoppedException)
{
throw;
}
catch (Exception ex)
{
ErrorHandler.WriteXmlError(ex);
}
}
示例3: WriteSubtree
string WriteSubtree (XPathNavigator nav)
{
StringWriter sw = new StringWriter ();
XmlWriterSettings settings = new XmlWriterSettings ();
settings.OmitXmlDeclaration = true;
settings.ConformanceLevel = ConformanceLevel.Fragment;
using (XmlWriter w = XmlWriter.Create (sw, settings)) {
nav.WriteSubtree(w);
}
return sw.ToString ();
}
示例4: XPathNavigatorToString
// I avoided OuterXml which includes indentation.
string XPathNavigatorToString (XPathNavigator nav)
{
var sw = new StringWriter ();
using (var xw = XmlWriter.Create (sw, xml_writer_settings))
nav.WriteSubtree (xw);
return sw.ToString ();
}
示例5: SaveCacheFile
private void SaveCacheFile(XPathNavigator nav)
{
if (String.IsNullOrEmpty(cacheFile))
return;
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.NewLineHandling = NewLineHandling.None;
try
{
using (XmlWriter writer = XmlWriter.Create(cacheFile, settings))
{
nav.WriteSubtree(writer);
}
}
catch (Exception)
{
// derp!
}
}
示例6: Initialize
private void Initialize(XPathNavigator navigator)
{
using (MemoryStream memStream = new MemoryStream())
{
using (XmlWriter writer = XmlWriter.Create(memStream))
{
navigator.WriteSubtree(writer);
writer.Flush();
memStream.Position = 0;
Initialize(memStream);
}
}
}
示例7: NavigatorToStream
public static Stream NavigatorToStream(XPathNavigator nav){
var sw = new MemoryStream();
var w = new XmlTextWriter(sw, Encoding.UTF8);
nav.WriteSubtree(w);
w.Flush();
sw.Position = 0;
return sw;
}
示例8: GetXElement
protected static XElement GetXElement(XPathNavigator navigator)
{
XDocument xDoc = new XDocument();
using (XmlWriter xmlWriter = xDoc.CreateWriter())
navigator.WriteSubtree(xmlWriter);
return xDoc.Root;
}