I have C# Program to Generate RDL File For whitch Show report in Reporting services. I use Linq to Xml to generate Xml.
When I try to add xmlns XAttribute to Report Element, I encounter several problems.
I test following methods:
first:
XDocument d = new XDocument(
new XDeclaration("1.0", "utf-8", "yes"),
new XElement("Report",
new XAttribute(XNamespace.Xmlns + "rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"),
new XAttribute(XNamespace.Xmlns + "cl", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition"),
new XAttribute("xmlns", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition"),
new XElement("DataSources", ""),
new XElement("DataSets", ""),
new XElement("ReportSections",
this is a part of my code witch show how generate xml:
second:
XNamespace reportDef = "http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition";
XDocument d = new XDocument(
new XDeclaration("1.0", "utf-8", "yes"),
new XElement(reportDef + "Report",
new XAttribute(XNamespace.Xmlns + "rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"),
new XAttribute(XNamespace.Xmlns + "cl", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition"),
new XElement("DataSources", ""),
new XElement("DataSets", ""),
new XElement("ReportSections",...
The first method returns an Error and second method adds attribute xmlns to all child node.
I want this format:
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">