<?xml version="1.0" encoding="utf-8" ?> 
- <ArrayOfAnyType xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/WebService1/index">
  <anyType xsi:type="xsd:string">XXXX字条串1</anyType> 
  <anyType xsi:type="xsd:string">XXXX字条串2</anyType> 
  <anyType xsi:type="xsd:string">XXXX字条串3</anyType> 
  <anyType xsi:type="xsd:string">XXXX字条串4</anyType> 
  <anyType xsi:type="xsd:string">XXXX字条串5</anyType> 
  </ArrayOfAnyType>1、以上XML存成一个“文件”可以直接绑定DATAGRID,如果把上面的XML作为一个string变量是否有办法绑定GRID。
2、如何用正则把里面的“XXXX字条串”取出来。

解决方案 »

  1.   

    1.保存到字符串?XmlDocument doc = new XmlDocument(); doc.LoadXml(yourxmlstring);
      

  2.   

    to:Edifier0709(腦袋重構中.....) 这样不行呀。  Dim doc As New XmlDocument()
                doc.LoadXml(str)
                Me.GridView1.DataSource = doc
                Me.GridView1.DataBind()
      

  3.   

    为什么要正则表达式?
    XPATH表达式不能用吗?把这个XML文档直接当作是数据文件来操作,这样才比较直观
      

  4.   

    为什么一定要正则表达式?
    XPATH不行?
    把XML文件当作数据来操作不是更好吗?