My XML almost starts with
xmlns:x="http://schema.metastorm.com/Metastorm.Common.Markup"
So to get to attribute x:Name with specyfic x:Type
<x:Object
x:Name="someName"
x:Type="{pref_-1582514068:MboField}">
I used this linq query:
string xmlns = "http://schema.metastorm.com/Metastorm.Common.Markup";
IEnumerable<string> values = from x in xdoc.Descendants(xmlns+"Object")
where x.Attribute(xmlns+"Type").ToString().EndsWith("MboField}")
select x.Attribute(xmlns+"Name").Value.ToString();
However I get error (System.Xml.XmlException) saying that colon character can't be used inside name. Of cours there is one in url.
What am I doing wrong? Is there some way to avoid using colon?
xmlnsshould be anXNamespace.var xmlns = XNamespace.Get("http://schema.metastorm.com/Metastorm.Common.Markup");. Keep the rest of your code the same. Here was the answer I received.