XmlTextWriter Confusion in the Compact Framework

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();
}
 
J

Jimmy A

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?
 
M

Mark Ihimoyan [MSFT]

Yes you are right. IE probably cached the old page and you'll have to hit
the refresh the button.
 

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