Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Linq to xml not working

Avatar of Aikencura
Aikencura asked on
XMLASP.NET
3 Comments1 Solution316 ViewsLast Modified:
Hi

Can somebody explain me why my code isn't working?



 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.IO;
using System.Data;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Linq;
using System.Diagnostics;

namespace TelSearchModule
{
    public partial class _Default : System.Web.UI.Page
    {

       


        protected void Page_Load(object sender, EventArgs e)
        {
            ///Start Test
            
            // Load XML doc
            XDocument rssFeed = XDocument.Load("http://tel.search.ch/examples/api-response.xml");
            // Define XML Namespace
            XNamespace Atom = "http://www.w3.org/2005/Atom";
            XNamespace OpenSearch = "http://a9.com/-/spec/opensearchrss/1.0/";
            XNamespace tel = "http://tel.search.ch/api/spec/result/1.0/";

            var entries = from entry in rssFeed.Descendants("entry")
                          select new
                          {
                              Title = entry.Element("title").Value,
                              FirstName = entry.Element("tel:FirstName").Value
                          };
}
}
}