|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem Reading XML from WebsiteI'm trying to read a bit of XML from the following site: http://www.wowarmory.com/character-sheet.xml?r=Bladefist&n=Coquette The xml document relies heavily on xsl... however if you view the source of the page you'll see that it is indeed raw xml that's being served. I'm using the following code to pull the xml document in string format: Public Shared Function GetPageAsString(ByVal address As Uri) As String Dim request As HttpWebRequest Dim response As HttpWebResponse = Nothing Dim reader As StreamReader Dim result As String Try request = DirectCast(WebRequest.Create(address), HttpWebRequest) response = DirectCast(request.GetResponse(), HttpWebResponse) reader = New StreamReader(response.GetResponseStream()) result = reader.ReadToEnd() Finally If Not response Is Nothing Then response.Close() End Try Return result End Function However when I view the resulting string value, it shows the xsl-parsed code. How can I retrieve just the raw xml? Regards, Scott M. Scott McNair wrote:
Show quoteHide quote > I'm trying to read a bit of XML from the following site: request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"> > http://www.wowarmory.com/character-sheet.xml?r=Bladefist&n=Coquette > > The xml document relies heavily on xsl... however if you view the source of > the page you'll see that it is indeed raw xml that's being served. > > I'm using the following code to pull the xml document in string format: > > Public Shared Function GetPageAsString(ByVal address As Uri) As String > Dim request As HttpWebRequest > Dim response As HttpWebResponse = Nothing > Dim reader As StreamReader > Dim result As String > > Try > request = DirectCast(WebRequest.Create(address), HttpWebRequest) > response = DirectCast(request.GetResponse(), HttpWebResponse) Your code simply makes a HTTP GET request and reads the response. If you > reader = New StreamReader(response.GetResponseStream()) > result = reader.ReadToEnd() > Finally > If Not response Is Nothing Then response.Close() > End Try > Return result > End Function > > However when I view the resulting string value, it shows the xsl-parsed > code. How can I retrieve just the raw xml? get HTML then the server sends HTML. It seems to help to set the HTTP UserAgent as shown above, then I get XML and not HTML.
Type inference
Read very large file in bytearray and upload to MSSQL how do you implement association between objects Check if libraries or program exist dataset question Web Server Read/Write Problem with ToolStripTextBox Insert smaller images into one Image object error with exe programs Need to develop an IDE add-on that would behave similar to the Find in Entire Solution |
|||||||||||||||||||||||