i will try to explain the problem very clear. I user MicroSoftReportViewer where i load my report. But before loading it i want to change somethings.Till here everything is ok. I want to use xpath but when i load the rdlc( xml ) file using XMLDocument the xpath expression does not work. The only xpath that work is “\” witch gets root. I opened the file with notepad and saw that the first xml node uses these schemas
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition"
xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
I tried to read the file using XMLReader with XMLSchema added but still xpath does not work. Please i will be very great grateful to get peace of code to see how to load the file so xpath works.
Best Regards,
Iordan
I´m afraid we´ll need to see your XPath statement to be sure, but my guess is an issue with namespaces.
The elements that are not prefixed are in the
default namespacewhich for the above document sets it tohttp://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition.
You XPath queries now need to include these namespaces in the queries. So, an selectSingleNode(
/elementnameicanseeinnotepad) will not give you anything.To add the namespaces in the query you will have to use the
XmlNamespaceManagerclass (or use the verbose syntax of XPath which i don´t recommend).Hope this helps.