problem with saving XML to xml file
-
When program enters public method MyClass.Flush 'document' has 5 childnodes. After program opens file.xml variable document has 0 childs - what is wrong :eek: ???
private static XmlDocument document;
....
/* load data from file*/
public void Flush() {
XmlTextWriter writer = new XmlTextWriter("file.xml",System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;
document.WriteTo( writer );
writer.Flush();
writer.Close();
}Thank you.
-
When program enters public method MyClass.Flush 'document' has 5 childnodes. After program opens file.xml variable document has 0 childs - what is wrong :eek: ???
private static XmlDocument document;
....
/* load data from file*/
public void Flush() {
XmlTextWriter writer = new XmlTextWriter("file.xml",System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;
document.WriteTo( writer );
writer.Flush();
writer.Close();
}Thank you.
check the previous System.Text.Encoding.UTF8 encoding format. have u checked preservewhitespace ? Paresh
-
When program enters public method MyClass.Flush 'document' has 5 childnodes. After program opens file.xml variable document has 0 childs - what is wrong :eek: ???
private static XmlDocument document;
....
/* load data from file*/
public void Flush() {
XmlTextWriter writer = new XmlTextWriter("file.xml",System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;
document.WriteTo( writer );
writer.Flush();
writer.Close();
}Thank you.
Cause it's static.