CSDN博客

img shenyisyn

XPathDocument的用法

发表于2004/10/10 16:23:00  2064人阅读

13.xml 内容有
<?xml version="1.0" encoding="gb2312"?>
<阿>
  <不>sdf</不>
</阿>

FileStream fso=new FileStream("c://13.xml",FileMode.Open);
   try
   {
    
   
    XPathDocument doc=new XPathDocument(fso);
    XPathNavigator nav=doc.CreateNavigator();
    XPathExpression exp=nav.Compile("/阿/不");
 
    XPathNodeIterator xn=nav.Select(exp);
    while(xn.MoveNext())
    {
     XPathNavigator nav2=xn.Current.Clone();
     MessageBox.Show(nav2.Value);
    }
  
     
    
   }
   catch
   {
    throw;
   }
   finally
   {
    fso.Close();
   }
阅读全文
0 0

相关文章推荐

img
取 消
img