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. C#
  4. read xml file into typed dataset

read xml file into typed dataset

Scheduled Pinned Locked Moved C#
xmlhelpquestion
6 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.
  • C Offline
    C Offline
    cellardoor0716
    wrote on last edited by
    #1

    I´m trying to read a xml file into typed dataset, but I really can´t get it done. Here´s a simple code of what I´m trying to do: typedDS.ReadXml("d:\\Test.xml"); I don´t get any exception, but there are no records in the dataset. Can anyone help me with this?

    cellardoor

    B S 2 Replies Last reply
    0
    • C cellardoor0716

      I´m trying to read a xml file into typed dataset, but I really can´t get it done. Here´s a simple code of what I´m trying to do: typedDS.ReadXml("d:\\Test.xml"); I don´t get any exception, but there are no records in the dataset. Can anyone help me with this?

      cellardoor

      B Offline
      B Offline
      bobsugar222
      wrote on last edited by
      #2

      does D:\Test.xml match the schema of the typed dataset?... If it doesn't, you may not have any data in your typed tables, but it may have created a new table from the xml data. Try iterating through your typedDS.Tables to check this out. Fan of Donny Darko? ;P

      C 1 Reply Last reply
      0
      • B bobsugar222

        does D:\Test.xml match the schema of the typed dataset?... If it doesn't, you may not have any data in your typed tables, but it may have created a new table from the xml data. Try iterating through your typedDS.Tables to check this out. Fan of Donny Darko? ;P

        C Offline
        C Offline
        cellardoor0716
        wrote on last edited by
        #3

        yes the xml file D:\Test.xml does match the schema of the typed datased. I tryied to validate it first and the validation was successful... I also itarated through the dataset tables and there aren´t any other tables.

        cellardoor

        B 1 Reply Last reply
        0
        • C cellardoor0716

          yes the xml file D:\Test.xml does match the schema of the typed datased. I tryied to validate it first and the validation was successful... I also itarated through the dataset tables and there aren´t any other tables.

          cellardoor

          B Offline
          B Offline
          bobsugar222
          wrote on last edited by
          #4

          hmmm.... perhaps try:

          typedDS.ReadXml("d:\\Test.xml",XmlReadMode.InferTypedSchema);

          or XmlReadMode.InferSchema

          C 1 Reply Last reply
          0
          • B bobsugar222

            hmmm.... perhaps try:

            typedDS.ReadXml("d:\\Test.xml",XmlReadMode.InferTypedSchema);

            or XmlReadMode.InferSchema

            C Offline
            C Offline
            cellardoor0716
            wrote on last edited by
            #5

            thanks now it´s working...

            cellardoor

            1 Reply Last reply
            0
            • C cellardoor0716

              I´m trying to read a xml file into typed dataset, but I really can´t get it done. Here´s a simple code of what I´m trying to do: typedDS.ReadXml("d:\\Test.xml"); I don´t get any exception, but there are no records in the dataset. Can anyone help me with this?

              cellardoor

              S Offline
              S Offline
              Seishin
              wrote on last edited by
              #6

              i don't suppouse d:\Test.xml is an empty file :D well, i've been using this method for some time and it works fine for me. maybe you should try adding some data to the tables in the dataset then ds.WriteXml(file) and then try newDs.ReadXml(file).. if this will work i'd mean your file is somehow bad, and if not then hmm.. you could also try putting the typedDS.ReadXml("d:\\Test.xml"); in try-carch block.. i had some situations when no error occured and after surrounding code with try-catch exception was handled..

              life is study!!!

              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