read xml file into typed dataset
-
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
-
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
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
-
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
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
-
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
hmmm.... perhaps try:
typedDS.ReadXml("d:\\Test.xml",XmlReadMode.InferTypedSchema);
or
XmlReadMode.InferSchema
-
hmmm.... perhaps try:
typedDS.ReadXml("d:\\Test.xml",XmlReadMode.InferTypedSchema);
or
XmlReadMode.InferSchema
thanks now it´s working...
cellardoor
-
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
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!!!