Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Cannot traverse RDLC file using Xpath

Cannot traverse RDLC file using Xpath

Scheduled Pinned Locked Moved XML / XSL
xmldatabasecomarchitecturehelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Krugger404
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • K Krugger404

      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

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      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

      K P 2 Replies Last reply
      0
      • L led mike

        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

        K Offline
        K Offline
        Krugger404
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • K Krugger404

          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

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          datastruct wrote:

          Sorry but the xml file is quite large(i did mention it in the post).

          That's no excuse. It's your responsibility to post just a fragment that is representative of your problem.

          led mike

          1 Reply Last reply
          0
          • L led mike

            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

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups