I use LINQ to parse XML a lot in my app, and generally don't have problems.

However, I ran into something this morning that is driving me nuts:

I have some XML that looks like this (this is the fragment within a larger
doc)

<HighRiskMapAreaList xmlns:a="
http://schemas.microsoft.com/2003/10/Serialization/Arrays";>
<a:string>AAA</a:string>
</HighRiskMapAreaList>

I need to extract a list of strings contained within HighRiskMapAreaList.

I'm doing this:

XNamespace ns = "http://schemas.microsoft.com/2003/10/Serialization/Arrays";;

// this works and q.Count() is 1
var q = (from x in DataDoc.Descendants("HighRiskMapAreaList") select
x.Element(ns + "string"));

foreach (XElement e in q)
{
  // this works in LinqPad, but crashes in MT with a null reference
exception
  Console.WriteLine(e.Value);
}

any ideas?
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to