EDN Admin
Well-known member
Hello everyone,
Does anyone know how to search an element inside a XML with namespace, let me explain this better.
I have a this XML
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition <br/>
<AutoRefresh>0</AutoRefresh><br/>
<DataSets><br/>
<DataSet Name="DataSet1 <br/>
<SharedDataSet><br/>
< SharedDataSetReference ><span style="text-decoration:underline /FRS_Company/Datasets/MySharedDataset</ SharedDataSetReference ><br/>
</SharedDataSet><br/>
...
I need to find inside my XML all SharedDataSetReference nodes,
Here is how I am trying
xelement = XElement.Load(report);
var g = from h in xelement.Elements("SharedDataSetReference") select h;
foreach (var c in g)<br/>
{<br/>
// change the value
c.Value = "new value";
}
If I run this I will never go inside the loop because I don have any Element with name
SharedDataSetReference , this is the LocalName no the XName, could anybody help me to find what the error is?
Thanks in advance.
peter
View the full article
Does anyone know how to search an element inside a XML with namespace, let me explain this better.
I have a this XML
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition <br/>
<AutoRefresh>0</AutoRefresh><br/>
<DataSets><br/>
<DataSet Name="DataSet1 <br/>
<SharedDataSet><br/>
< SharedDataSetReference ><span style="text-decoration:underline /FRS_Company/Datasets/MySharedDataset</ SharedDataSetReference ><br/>
</SharedDataSet><br/>
...
I need to find inside my XML all SharedDataSetReference nodes,
Here is how I am trying
xelement = XElement.Load(report);
var g = from h in xelement.Elements("SharedDataSetReference") select h;
foreach (var c in g)<br/>
{<br/>
// change the value
c.Value = "new value";
}
If I run this I will never go inside the loop because I don have any Element with name
SharedDataSetReference , this is the LocalName no the XName, could anybody help me to find what the error is?
Thanks in advance.
peter
View the full article