J
Jimmy A
Example:
On the second time this method is called, the xml file is not updated
for some reason. Even if I delete the "XmlTextWriterTest.xml" file
inbetween calls it still writes the original file. I am a bit
confused and new to Pocket PC dev. I could provide all the code but
this should be enough to display the behavior. Just make a Pocket PC
app with two textboxes and a button. On each button press call this
method.
In the Full .NET framework it works fine, just not the Compact
Framework.
HELP!! and Thanks!
private void WriteXmlFile(string name, string city)
{
xmlWriter = new XmlTextWriter ("XmlTextWriterTest.xml", null);
xmlWriter.Formatting = Formatting.Indented;
xmlWriter.WriteStartDocument(false);
xmlWriter.WriteComment("This file is a test xml file");
xmlWriter.WriteStartElement("test");
xmlWriter.WriteAttributeString("name", name);
xmlWriter.WriteAttributeString("city", city);
DateTime now = DateTime.Now;
xmlWriter.WriteAttributeString("date", now.ToShortDateString());
xmlWriter.WriteAttributeString("time", now.ToShortTimeString());
xmlWriter.WriteEndElement();
xmlWriter.WriteEndDocument();
xmlWriter.Flush();
xmlWriter.Close();
}
On the second time this method is called, the xml file is not updated
for some reason. Even if I delete the "XmlTextWriterTest.xml" file
inbetween calls it still writes the original file. I am a bit
confused and new to Pocket PC dev. I could provide all the code but
this should be enough to display the behavior. Just make a Pocket PC
app with two textboxes and a button. On each button press call this
method.
In the Full .NET framework it works fine, just not the Compact
Framework.
HELP!! and Thanks!
private void WriteXmlFile(string name, string city)
{
xmlWriter = new XmlTextWriter ("XmlTextWriterTest.xml", null);
xmlWriter.Formatting = Formatting.Indented;
xmlWriter.WriteStartDocument(false);
xmlWriter.WriteComment("This file is a test xml file");
xmlWriter.WriteStartElement("test");
xmlWriter.WriteAttributeString("name", name);
xmlWriter.WriteAttributeString("city", city);
DateTime now = DateTime.Now;
xmlWriter.WriteAttributeString("date", now.ToShortDateString());
xmlWriter.WriteAttributeString("time", now.ToShortTimeString());
xmlWriter.WriteEndElement();
xmlWriter.WriteEndDocument();
xmlWriter.Flush();
xmlWriter.Close();
}