Aikencura
asked on
Linq to xml not working
Hi
Can somebody explain me why my code isn't working?
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
};
}
}
}
ASKER
I don't understand, can you explain in "noob" language please..with my code.
If you test your suggestion, you get:
{"The '{' character, hexadecimal value 0x7B, cannot be included in a name."}
If you test your suggestion, you get:
{"The '{' character, hexadecimal value 0x7B, cannot be included in a name."}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Example:
http://msdn.microsoft.com/en-us/library/cc165615.aspx
planetsDoc = XDocument.Load("../../Plan
stacky.DataContext = planetsDoc.Element("{http://planetsNS}Sola