<?xml version="1.0" encoding="utf-8"?>
<Configuration>
  <Advertising>
    <palylist>@"D:\Winform\VnvtripPlayer\VnvtripPlayer\a.asx"</palylist>
  </Advertising>
</Configuration>
怎么把playlist节点内容读出来

解决方案 »

  1.   

    XmlDocument doc = new XmlDocument();
    doc.Load(file);
    XmlNode node = doc.SelectSingleNode("Configuration/Advertising/palylist");
      

  2.   

    XmlNode node;
          XmlElement root = doc.DocumentElement;
          node= root.SelectSingleNode("\Configuration\Advertising\palylist");
          string s = node.InnerText;
      

  3.   

    XmlNode node = doc.SelectSingleNode("palylist");
    string s = node.InnerXml;
      

  4.   

    如果频繁操作这个xml文件的话,是不是这样好一点?
    string fname = @"D:\palylist.xml";
    FileStream fs = new FileStream(fname,FileMode.Open );
    XmlTextReader xrd = new XmlTextReader (fs);
    XmlDocument doc = new XmlDocument();
    doc.Load(xrd);
    XmlNode nameNode = doc.SelectSingleNode("\Configuration\Advertising\palylist");
    string s = nameNode.InnerXml;
      

  5.   

    学习,
    lovefootball(蟑螂(生活就是扯淡--做人要放低姿态))
    XmlNode node = doc.SelectSingleNode("Configuration/Advertising/palylist");Avoid(辞职了) ( )
    node= root.SelectSingleNode("\Configuration\Advertising\palylist");怎么连人的斜线不同方向的哈?有什么区别???
      

  6.   

    怎么连人的斜线不同方向的哈?有什么区别???
    -------〉
    他的是错的
    :)
    在XPath中,应该用/而不是\
      

  7.   

    Avoid(辞职了) ( )
    node= root.SelectSingleNode("\Configuration\Advertising\palylist");
    明显的错的嘛,,,xml中的路径哪这样写的。晕
      

  8.   

    lz:告诉你xml的所有查询方法!http://community.csdn.net/Expert/topic/5163/5163369.xml?temp=.4602167
      

  9.   

    如果是取文件里所有的节点,并且不限定路径
    可以用SelectNodes("//palylist")