Cannot traverse RDLC file using Xpath
-
Hi, I need to dynamically modify a rdlc report (it is basically and xml document) to remove some columns at runtime. I have tried using Xpath to retrieve the required nodes but to no avail.The SelectSingleNode function returns null and the SelectNodes function returns 0. Please find a sample rdlc file. I need to remove the node <TableCell> <ReportItems> <Textbox Name="IND_PASSPORT_EXPIRY_DATE1"> <ZIndex>17</ZIndex> <Style> <BorderStyle> <Default>Solid</Default> </BorderStyle> <TextAlign>Center</TextAlign> <PaddingLeft>1pt</PaddingLeft> <PaddingBottom>1pt</PaddingBottom> <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "DarkGray")</BackgroundColor> <PaddingRight>1pt</PaddingRight> <PaddingTop>1pt</PaddingTop> </Style> <CanGrow>true</CanGrow> <Value>=Fields!IND_PASSPORT_EXPIRY_DATE.Value</Value> </Textbox> </ReportItems> </TableCell> I have tried all sort of Xpath patterns to no avail. Can you please help me on this? The rdlc file is as follows (Sorry for the length.Do paste it in notepad and open it in ie to see the structure): <?xml version="1.0" encoding="utf-8"?> <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> <DataSources> <DataSource Name="ConnectionString"> <ConnectionProperties> <ConnectString /> <DataProvider>SQL</DataProvider> </ConnectionProperties> rd:DataSourceID22362927-fb28-4ac1-bbee-8cf51540142a</rd:DataSourceID> </DataSource> </DataSources> <BottomMargin>0.5in</BottomMargin> <RightMargin>0.5in</RightMargin> <PageWidth>11.69in</PageWidth> rd:DrawGridtrue</rd:DrawGrid> <InteractiveWidth>8.5in</InteractiveWidth> <rd:SnapToGrid
-
Hi, I need to dynamically modify a rdlc report (it is basically and xml document) to remove some columns at runtime. I have tried using Xpath to retrieve the required nodes but to no avail.The SelectSingleNode function returns null and the SelectNodes function returns 0. Please find a sample rdlc file. I need to remove the node <TableCell> <ReportItems> <Textbox Name="IND_PASSPORT_EXPIRY_DATE1"> <ZIndex>17</ZIndex> <Style> <BorderStyle> <Default>Solid</Default> </BorderStyle> <TextAlign>Center</TextAlign> <PaddingLeft>1pt</PaddingLeft> <PaddingBottom>1pt</PaddingBottom> <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "DarkGray")</BackgroundColor> <PaddingRight>1pt</PaddingRight> <PaddingTop>1pt</PaddingTop> </Style> <CanGrow>true</CanGrow> <Value>=Fields!IND_PASSPORT_EXPIRY_DATE.Value</Value> </Textbox> </ReportItems> </TableCell> I have tried all sort of Xpath patterns to no avail. Can you please help me on this? The rdlc file is as follows (Sorry for the length.Do paste it in notepad and open it in ie to see the structure): <?xml version="1.0" encoding="utf-8"?> <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> <DataSources> <DataSource Name="ConnectionString"> <ConnectionProperties> <ConnectString /> <DataProvider>SQL</DataProvider> </ConnectionProperties> rd:DataSourceID22362927-fb28-4ac1-bbee-8cf51540142a</rd:DataSourceID> </DataSource> </DataSources> <BottomMargin>0.5in</BottomMargin> <RightMargin>0.5in</RightMargin> <PageWidth>11.69in</PageWidth> rd:DrawGridtrue</rd:DrawGrid> <InteractiveWidth>8.5in</InteractiveWidth> <rd:SnapToGrid
-
What is your damage? Don't post some trash like that. Your problem is simple, you have not yet learned XPath, go learn it.
led mike
Sorry but the xml file is quite large(i did mention it in the post). In fact, SelectSingleNode has some problem when reading rdlc files due to its namespace declaration. So, one needs to add things of the sort for it to work: XmlNamespaceManager ns = new XmlNamespaceManager(tmpXmlDoc.NameTable); ns.AddNamespace("ns", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition"); ns.AddNamespace("rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"); That's it Mike. Relax and go around a little from time to time. It will do you good! :-p
Carpe diem, Krg
-
Sorry but the xml file is quite large(i did mention it in the post). In fact, SelectSingleNode has some problem when reading rdlc files due to its namespace declaration. So, one needs to add things of the sort for it to work: XmlNamespaceManager ns = new XmlNamespaceManager(tmpXmlDoc.NameTable); ns.AddNamespace("ns", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition"); ns.AddNamespace("rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"); That's it Mike. Relax and go around a little from time to time. It will do you good! :-p
Carpe diem, Krg
-
What is your damage? Don't post some trash like that. Your problem is simple, you have not yet learned XPath, go learn it.
led mike
led mike wrote:
Don't post some trash like that.
I second that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon