LINQ to XML: Get Element names without resolving the prefix to its uri

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
I have simple LINQ query to get all the element names.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; var q = <span style="color:Blue; from element <span style="color:Blue; in document.Descendants()
<span style="color:Blue; select element.Name;

<span style="color:Blue; foreach (<span style="color:Blue; var name <span style="color:Blue; in q)
{
Console.WriteLine(<span style="color:#A31515; "Element: " + name);
}
[/code]
The query is working fine but, the prefix in the element names are getting resolved to its original namespace uri (fully qualified name). I do not want this to happen.
I want "prefix:element" itself as the output.
How to achieve this in LINQ in the above query.
Thanks & Regards,
Gubbi In Bangalore. <hr class="sig Gubbi In Bangalore

View the full article
 
Back
Top