kudrik Posted May 7, 2013 Share Posted May 7, 2013 XML парсер при сохранении заменяет символы < > & " ' на специальные символы (например "<" -> "<"), а при считывании не заменяет их обратно. in-english: XML parser when saving replaces the characters <> & " ' on special characters (for examplе "<" -> "<"), and when reading is not a substitute them back. Link to comment
binstream Posted May 16, 2013 Share Posted May 16, 2013 This is a common behavior for XML parsers since otherwise there will be malformed XML documents. Link to comment
ulf.schroeter Posted May 16, 2013 Share Posted May 16, 2013 when reading it does NOT substitute them back. Shouldn't be common behaviour that correctly encoded special characters cannot be properly decoded again... Link to comment
kudrik Posted May 30, 2013 Author Share Posted May 30, 2013 Собственно, можно поподробнее, ликбез, почему это нормально, когда в одну сторону подмена символов корректна, а в обратную нет?Нужен метод корректной генерации XML файлов.in-english:Actually, possible more in detail, literacy campaign, why is it normal behavior for parser ? Why is conversion in one direction - the right, the other way - it is wrong?Need a method of generating the correct XML files. Link to comment
sebastianbah Posted April 24, 2014 Share Posted April 24, 2014 Hi Kudrik, Sorry for the late reply. This issue is fixed.If you need to shield specific symbol and save it into XML you can use xml.setData(), and you can use xml.setXmlData() to paste the symbol into xml data as it is.As an example: Xml xml = new Xml(); xml.setName("test"); xml.setData("my data <"); // use xml.setXmlData() here not to shield "<" xml.save("test/test.xml"); Xml xml_0 = new Xml(); xml_0.load("test/test.xml"); log.message("xml data %s \n",xml_0.getData()); You will get valid XML file with the following data <test>my data <</test> And log message: "my data <" Link to comment
ulf.schroeter Posted April 24, 2014 Share Posted April 24, 2014 Sorry for the late reply. hey sebastianbah, no need for excuses, answer only took less than a year... :rolleyes: Link to comment
Recommended Posts