I have a dataset, "AllEventData", and in that dataset is (for the moment) only one table called buttonData. It has 3 columns - an autoincrementing number primary key, a name (typeof(string)), and a rectangle. The third column is specifically typeof(Rectangle). I display it all with a datatablepanel.
I did the AllEventData.WriteXML method to write the file with no special parameters, and that seems to work fine - I get a file that looks like this:
<?xml version="1.0" standalone="yes"?>
<AllEventData>
<ButtonData>
<ID>1</ID>
<Button_x0020_Name>sdfh</Button_x0020_Name>
<Button_x005F_x0020_Location xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Location>
<X>480</X>
<Y>186</Y>
</Location>
<Size>
<Width>95</Width>
<Height>67</Height>
</Size>
<X>480</X>
<Y>186</Y>
<Width>95</Width>
<Height>67</Height>
</Button_x005F_x0020_Location>
</ButtonData>
</AllEventData>
But when I do a AllEventData.ReadXML of the same file, it only fills the datatablepanel with the button names, not the rectangle locations.
I tried doing a write of the schema separately:
using (SaveFileDialog saveFileDialog1 = new SaveFileDialog())
{
saveFileDialog1.Filter = "XML | *.xml";
saveFileDialog1.Title = "Save File";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
AllEventData.WriteXml(saveFileDialog1.FileName);
string xsdFileName = saveFileDialog1.FileName.Substring(0, saveFileDialog1.FileName.Length - 3) + "xsd";
AllEventData.WriteXmlSchema(xsdFileName);
}
}
and the same basic thing in reverse to read it with a schema:
using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
{
openFileDialog1.Filter = "XML | *.xml";
openFileDialog1.Title = "Open File";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
AllEventData.Clear();
string xsdFileName = openFileDialog1.FileName.Substring(0, openFileDialog1.FileName.Length - 3) + "xsd";
AllEventData.ReadXmlSchema(xsdFileName);
AllEventData.ReadXml(openFileDialog1.FileName);
}
}
But still not getting there.
Why isn't ReadXML working to read what WriteXML wrote?