Hi,
I try to parse an xml file by the following way:
// read the content var xml_file = File(xml_file_path); xml_file.open('r'); var content = xml_file.read(); xml_file.close(); // add the node var root = new XML(content); var unit_test_resolution = <unit-test>{resolution}</unit-test>; root.appendChild(unit_test_resolution); // replace the file var my_file = new File(xml_file_path); var edit_content = root.toXMLString(); my_file.open('w'); my_file.writeln('<?xml version="1.0" encoding="UTF-8"?>'); my_file.writeln(edit_content);
I'm not sure that is a good solution can anyone help me? For example, my file already has the '<?xml version="1.0" encoding="UTF-8"?>' header. But if I read it by this way I have to put it each time egain …
In advance thanks you for your help.
Best regards.
Bastien