Xml Web URL

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

LVL 16
Who is Participating?
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
You can directly use as

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

Are you doing this in Winforms?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.