Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I wasn't sure where else to put this question....

 

Here is what I am wanting to do.

 

I have a Blog feed of which I am wanting to read .....

 

Here is how this blog works... its an artist blog... I'm the artist.... I am wanting to read the xml feed at http://mbstudiosdailypaintings.blogspot.com/atom.xml and within each post on the blog is a image ... I am wanting to get the image and add it to a gallery to be viewed on a web page.

 

So each new image automatically add it to the gallery.

 

vbMarkO

Visual Basic 2008 Express Edition!
Posted

WebRequest and WebResponse

 

There are three parts to this - downloading the XML feed, parsing the XML, and downloading the images. I suggest using the WebRequest and WebResponse classes:

 

WebRequest      webReq;
WebResponse     webResp;
XmlDocument     xDoc;
Image           dlImage;

webReq = WebRequest.Create("http://mbstudiosdailypaintings.blogspot.com/atom.xml");
webResp = webReq.GetResponse();

xDoc = new XmlDocument();
xDoc.Load(webResp.GetResponseStream());

//Parse XML here


//To get an image:
webReq = WebRequest.Create(urlToTheImage);
webResp = webReq.GetResponse();

dlImage = Image.FromStream(webResp.GetResponseStream());

//Do something with dlImage

 

All thats needed now is code for parsing the image URLs out of the XML, and making the code more robust.

 

Good luck :cool:

Never trouble another for what you can do for yourself.
Posted

Im sorry I guess I should of stated I dont do C#

 

I might be able to convert it but then IM not sure here as I get turned around when it comes to C#

 

VbMarkO

Visual Basic 2008 Express Edition!
Posted

Conversion

 

In this case the conversion from C# to VB.Net is simple, as no control structures have been used.

 

  1. Change the first 4 lines:
     
    Dim webReq As WebRequest
    Dim webResp As WebResponse
    Dim xDoc As XmlDocument
    Dim dlImage As Image


     

  2. Change comment lines // to '
     
  3. Remove the trailing semicolons from all other lines

 

If you edit your profile, you can specify your .Net preferred language, and this is displayed in your user info next to each post.

 

:)

Never trouble another for what you can do for yourself.
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...