Read Xml data

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Martyn Fewtrell (mfewtrell_at_networkclub.co.uk)
Date: 07/26/04


Date: Mon, 26 Jul 2004 13:26:16 +0100

I am having a problem reading an Xml file and loading it into a dataset in
VB.net (ASP).

I seem to be able to load the remote file from the Url but once in memory I
cant manage to load it in to a dataset.

The readXml appears to want to read a file rather than a variable and I'm
not sure how to get around this issue.

I've tried loading to a file stream and converting the strFile to an
XmlDocument but this doesn't appear to get me any further.

I known the code at the bottom doesn't work I have listed it to put over the
idea of what I am trying to do.

Martyn Fewtrell
mfewtrell@networkclub.co.uk

--------------------------------------------
'get data

Dim Url As String = "http://www.url/file.xml"

Dim Request As HttpWebRequest

Dim Response As WebResponse

Dim strFile As String

Try

Request = CType(WebRequest.Create(Url), HttpWebRequest)

Response = Request.GetResponse()

litError1.Text = "Response Recieved"

Catch ex As Exception

litError1.Text = "Response Not Recieved"

End Try

'load Dataset

Dim ds As DataSet = New DataSet

ds.ReadXml(strData)

----------------------------------------------------------------------------



Relevant Pages

  • Re: Read Xml data
    ... >> I am having a problem reading an Xml file and loading it into a dataset ... >> cant manage to load it in to a dataset. ... > WebResponse.GetResponseStream method which returns a Stream. ... > Dim Response As WebResponse ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Very slow code when loading a combo box with number 1 to 30000 (see code)
    ... Dim i As Integer ... 'add quantity choices ... I want to load the combo box with number 1 to 30,000 which covers the ... setting visible false before loading, and true when done, usually helps. ...
    (microsoft.public.vb.general.discussion)
  • Re: Faster Combobox loading
    ... You may instead want to consider partial loading, based on what the user types. ... Dim filPath As String ... Dim xCnt As Integer ... ' Load the state & city names ...
    (microsoft.public.vb.general.discussion)
  • Re: [opensuse] How to set up LIRC?
    ... and if not then loading it and setting it to load at boot time. ... I Googled around and learned a bit about loading kernel modules but nothing answered this question. ... Well further Google attempts and a visit to the LIRC website seemed to indicate that I need another module loaded in the kernel called lirc_serial. ...
    (SuSE)
  • Re: Next Version of GDI+ (maybe GDI+ 2.0)
    ... loading and manipulating of such files isn't lightning fast unless you have really powerfull dedicated hardware. ... to see whole image you need to read whole image, and then eventualy generate a smaller sample for display. ... BUT to have this smaler sample you need to load ALL the pixels of oryginal image. ...
    (microsoft.public.dotnet.framework.drawing)