用xpathnavigator和實體引用
xpathnavigator
在追加時采用實體引用
using System
using System
class Program
{
static StreamWriter sw = new StreamWriter(@
//創建調用的實體
static XmlTextWriter xtw = new XmlTextWriter(sw);
static void Main(string[] args)
{
XPathDocument doc = new XPathDocument(@
//first
XPathNavigator navigator = doc
navigator
xtw
CreatFiles(
WriteRecursive(navigator); //從根節點開始
xtw
xtw
}
static private void WriteRecursive(XPathNavigator navigator)
{
if (navigator
{
navigator
WriteNode(navigator);
WriteRecursive(navigator);
navigator
while (navigator
{
WriteNode(navigator);
WriteRecursive(navigator);
}
if (navigator
{
xtw
}
}
else
xtw
}
static private void WriteNode(XPathNavigator navigator)
{
if (navigator
{
xtw
//寫文本節點
}
else if (navigator
{
xtw
//寫元素節點
}
}
static private void CreatFiles(string M_str_fname)
{
XmlTextWriter xWriter = new XmlTextWriter(M_str_fname +
xWriter
xWriter
xWriter
string name = M_str_fname +
xWriter
xWriter
xWriter
xWriter
xWriter
xWriter
xWriter
}
}
在vs
From:http://tw.wingwit.com/Article/program/net/201311/13362.html