Xml Web URL

Posted on 2011-05-04
Medium Priority
Last Modified: 2012-05-11
Hey I have the following code below, I am trying to map a URL to an XML Document so I can query it! I am having trouble getting it to work, I get a null reference exception on the MapPath.
Dim xmlPath As String = HttpContext.Current.Server.MapPath("http://example.com")

Dim feedXML As XDocument = XDocument.Load(xmlPath)

        Dim query = _
           From c In feedXML.Descendants("example") _
           Select c.@title

Open in new window

Question by:disrupt
LVL 83

Expert Comment

ID: 35690178
Are you doing this in Winforms?
LVL 16

Accepted Solution

Imran Javed Zia earned 2000 total points
ID: 35690261
You can directly use as

Dim feedXML As XDocument = XDocument.Load("http://example.com")


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question