using System;
using System.Xml;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string xmlPath = "F:\\资料\\document\\document.xml";
XmlReader rdr = XmlReader.Create(xmlPath);
while (rdr.Read())
{
if (rdr.NodeType == XmlNodeType.Element)
{
string elementName = rdr.Name;
if (elementName == "w:sectPr")
{
Console.WriteLine(rdr.Name+" "+rdr.Value);
}
}
}
Console.ReadLine();
}
}
}
//读取指定节点及其包含的所有内容
using System;
using System.Xml;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string xmlPath = "F:\\资料\\document\\document.xml";
XmlReader rdr = XmlReader.Create(xmlPath);
while (rdr.Read())
{
if (rdr.NodeType == XmlNodeType.Element)
{
if (rdr.Name == "w:sectPr")
{
Console.WriteLine(rdr.ReadOuterXml());
}
}
}
Console.ReadLine();
}
}
}