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

我已经从.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";

希望它有帮助.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....