XmlTextWriter Confusion in the Compact Framework

  • Thread starter Thread starter Jimmy A
  • Start date Start date
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();
}
 
Looks like this a result of Pocket IE caching... I was viewing the xml
file I was generating in Pocket IE and it was caching the old one, and
not showing the new one?
 
Yes you are right. IE probably cached the old page and you'll have to hit
the refresh the button.
 
Back
Top