Linq 2 XML - reading xml with name space

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi.<br/>
So im trying to read an xml where the root element as a name space on it, like this:
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition <br/>

but when i query for it specific elements i get null objects, even that the elements are there. <br/>

XDocument xmlDoc2 = XDocument.Load(path2);<br/>
var childs2 = xmlDoc2.Elements("Report").Elements("Page").Elements("PageHeader");<br/>
<br/>
I tested on a similar xml, but remove the ns declaration and it references from the xml and i can read it. <br/>
So can someone help me on this?


View the full article
 
Back
Top