xml获取属性值的方法

 sSqlstr += string.Format(@" and businessattr.value('(/Arch/Field[@Name=""发文单位$$""])[1]','varchar(50)') like '%{0}%'", Request.QueryString["FaWenDanWei"]);

 

  private string GetFaWenDanWei(string businessAttrXml)
    {
        string result = string.Empty;
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(businessAttrXml);
        var node = doc.SelectSingleNode("Arch/Field[@Name='发文单位$$']");
        if (node != null)
        {
            result = node.InnerText;
        }
        return result;
    }

posted @ 2015-03-31 16:05  尹成亮  阅读(2061)  评论(0编辑  收藏  举报