I am trying to write to a XML file.
I can write some values but limited. When I add an extra line or value the xml file stop updating and all commands I have after the xml.close(); aren't executed
File xml = FileSystem.open("/mnt/sda1/Data/data.xml", FILE_WRITE); // open the file
if(xml){
Serial.println("XML Opened");
xml.println("<?xml version=\'1.0\' encoding=\'UTF-8\'?> ");
xml.println("<sea>");
xml.println("\t<temperatures>"); //ASCII control codes (TAB)
xml.print("\t\t<water>");
xml.print(waterTmp);
xml.println("</water>");
xml.println("\t</temperatures>");
xml.println("</sea>");
xml.close();
}
else{
Serial.print("XML Error");
}
For e.g if I add
xml.print("\t\t<air>");
xml.print(airTMP);
xml.println("</air>");
If this lines of code are alone in a sketch everything is good. Another strange thing is if I add the same line twice or more times it can write them to the file.
Do you have any idea how this problem could be solved?