I have a System.Web.UI.WebControls.Xml control (Xml1) in a webforms app that I have upgraded from .NET 2.0 to .NET 4.0
I am getting two warnings from the code-behind page that I'd like to do something about.
...
Dim ds As DataSet = app.GetObjects
Dim xmlDoc As New System.Xml.XmlDataDocument(ds)
Xml1.Document = xmlDoc
Xml1.TransformSource = "~/xslt/admin_objectslist.xslt"
...
From the second line I get the warning:
'System.Xml.XmlDataDocument' is obsolete: 'XmlDataDocument class will be removed in a future release.'.
And from the third line I get the warning:
'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.
What is the recommended .NET 4.0 replacement for this?
ds.I ran into this problem with 3.5 as well. Here is what I came up with:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(ds.GetXml());
xml1.XPathNavigator = xmlDoc.CreateNavigator();
xml1.TransformSource = @"~/XSLT/LogEntryTransform.xslt";
Hope it helps.