finding element that defines namespace linq



have the folowing xml



<configuration>
<Settings version='1.0'>

<applications>
<conn:Connections xmlns:conn='urn:Connections/1.0'>
<conn:data name='Auditing'>
<conn:table>foo</conn:tableowner>
</conn:data>
</conn:Connections >
<applications>
<configuration>


Can get an element without a namesapace via



string name = "string name = "dbconnections";
XElement dbconnections = config.Descendants( name).First();";

XElement dbconnections = config.Descendants( name).First();


but can't get the conn element with the following code:



name = "Connections";
XNamespace ns2 = "urn:Connections/1.0";
var dataArea = from x in config.Descendants(ns2 + name)

No comments:

Post a Comment