加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 替换过时的System.Xml.XmlDataDocument?

发布时间:2020-12-15 23:28:52 所属栏目:asp.Net 来源:网络整理
导读:我已经从.NET 2.0升级到.NET 4.0的Webforms应用程序中有一个System.Web.UI.WebControls.Xml控件(Xml1) 我从代码隐藏页面得到两个警告,我想做一些事情. ... Dim ds As DataSet = app.GetObjectsDim xmlDoc As New System.Xml.XmlDataDocument(ds)Xml1.Documen
我已经从.NET 2.0升级到.NET 4.0的Webforms应用程序中有一个System.Web.UI.WebControls.Xml控件(Xml1)

我从代码隐藏页面得到两个警告,我想做一些事情.

... 
Dim ds As DataSet = app.GetObjects
Dim xmlDoc As New System.Xml.XmlDataDocument(ds)
Xml1.Document = xmlDoc
Xml1.TransformSource = "~/xslt/admin_objectslist.xslt"
...

从第二行我得到警告:

‘System.Xml.XmlDataDocument’ is obsolete: ‘XmlDataDocument class will be removed in a future release.’.

从第三行我得到警告:

‘Public Property Document As System.Xml.XmlDocument’ is obsolete: ‘The recommended alternative is the XPathNavigator property. Create a System.Xml.XPath.XPathDocument and call CreateNavigator() to create an XPathNavigator.

为什么推荐使用.NET 4.0替代?

解决方法

d.我也遇到了这个问题,3.5.这是我想出来的:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(ds.GetXml());
xml1.XPathNavigator = xmlDoc.CreateNavigator();                
xml1.TransformSource = @"~/XSLT/LogEntryTransform.xslt";

希望它有帮助.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读