A question on DataSet.ReadXml.

  • Thread starter Manuel Vázquez Acosta
  • Start date
M

Manuel Vázquez Acosta

Hi all,

I'm dealing with a buggy-like behaviour when I call ReadXml method of
DataSet.

Here the scene:

I have myCustomDset.xsd and its associated/generated myCustomDset.cs; now my
data is stored in an xml file, say data.xml.

If I try to fill the DataSet without calling ReadXmlScheme, it seems the
DataSet doesn't fill correctly (at all?):

myCustomDset dset = new myCustomDset();
// If I comment or remove the following line, the DataSet doesn't fill
correctly (or at all)
myCustomDset.ReadXmlSchema(strDataFileName);
myCustomDset.ReadXml(strDataFileName);


From the docs:

ReadXml: Reads XML schema and data into the DataSet

Notice it states the schema is also read.


A bug or not a bug? That's my question ;-)

Regards,
Manuel.
 
G

Guest

Hi
Try using something like ds.ReadXml("x", XmlReadMode.ReadSchema) which will
read the schema. If you look at the help for readxmlshema, you will notice
that it mentions that the ReadXmlSchema method is generally invoked before
invoking the ReadXml method.
Thanks
Ibrahim
 
M

Manuel Vázquez Acosta

Hum, ok that works; but I'm still concerned about the possible overhead
caused by this step; I wonder: What is the advantage in generating the
myCustomDset class if it still needs to read the Schema? Or reading schema
means to validate whether the given xml represents a valid dataset?

Thanks,
Manuel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top