Groups | Blog | Home
all groups > dotnet xml > may 2006 >

dotnet xml : XML ASP.NET 2.o Issue


SK
5/14/2006 6:32:25 PM
Hi,

I have the following code and I'm using News.xsl to read the XML file -

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'----------------------------------------------------------------------------
THIS PAST (myXml.Document) IS NOT WORKING IN ASP.NET 2.0
'----------------------------------------------------------------------------
myXml.Document = getXML(nSource.SelectedItem.Value)
End Sub

Function getXML(ByVal sourceFile As String)
Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(sourceFile)
Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()
Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStream())
Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument
doc.Load(myReader)
getXML = doc
End Function

How to fix this issue? Please provide an example.

Thanks
SK

Oleg Tkachenko [MVP]
5/15/2006 12:00:00 AM
What exactly doesn't work? Any exceptions?

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com

[quoted text, click to view]
SK
5/15/2006 8:30:46 AM
When I run it it won't show me any output of RSS feeds.
myXml.Document tells me that it is obsolete in asp.net 2.0 and use
XPathNavigator.

I just need a replacement for myXml.Document that works with ASP.net 2.0.
The project is to take any RSS feeds and display it using any xsl file.

Thanks


[quoted text, click to view]
SK
5/15/2006 9:21:59 AM
It is an XML object from the toolbox.


[quoted text, click to view]

Martin Honnen
5/15/2006 2:40:00 PM


[quoted text, click to view]

What type is myXml?


--

Martin Honnen --- MVP XML
Martin Honnen
5/15/2006 3:58:46 PM


[quoted text, click to view]

What you should do with .NET 2.0 instead of setting myXml.Document is e.g.
myXml.XPathNavigator = new
XPathDocument(myResponse.GetResponseStream()).CreateNavigator()
That way you don't get the obsolete warning.


--

Martin Honnen --- MVP XML
AddThis Social Bookmark Button