Jump to content

[SOLVED] XML parser error


photo

Recommended Posts

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
  • 2 weeks later...

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
  • 2 weeks later...

Собственно, можно поподробнее, ликбез, почему это нормально, когда в одну сторону подмена символов корректна, а в обратную нет?
Нужен метод корректной генерации 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
  • 10 months later...

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
×
×
  • Create New...