Read XML Data from a Page ?

W

WJ

**: I m doing a cross-post here. it seems that XML folks does not deal with
Asp.Net form **

When you click on a link from a web site, it gives you a page exactly like
the following. How can I extract the data using code-behind without
requiring user to perform a "Save As" to an XML file ? I would like to read
the data and record it to a database without user touching it ! (My page is
..aspx)

******************************************************
<?xml version="1.0" encoding="utf-8" ?>
- <NameList>
- <Names>
<LastName>Hamilton</LastName>
<FirstName>Rick</FirstName>
<MiddleNamae>M</MiddleNamae>
</Names>
- <Names>
<LastName>Elton</LastName>
<FirstName>John</FirstName>
<MiddleNamae>D</MiddleNamae>
</Names>
</NameList>
******************************************************

Thanks

John
 
D

Denny Britz

Hi,

you can do this by using System.Net:

WebClient client = new WebClient();
string xml = System.Text.Encoding.UTF8.GetString(client.DownloadData(url));
// process xml...
 
W

WJ

Denny Britz said:
Hi,

you can do this by using System.Net:

WebClient client = new WebClient();
string xml =
System.Text.Encoding.UTF8.GetString(client.DownloadData(url));
// process xml...

Thanks Denny, That works very nicely.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top