Jump to content

[SOLVED] XML parser error


photo

Recommended Posts

Posted

XML парсер при сохранении заменяет символы < > & " ' на специальные символы (например "<" -> "<"), а при считывании не заменяет их обратно.

 

in-english:

 

XML parser when saving replaces the characters <> & " ' on special characters (for examplе "<" -> "<"), and when reading is not a substitute them back.

  • 2 weeks later...
Posted

This is a common behavior for XML parsers since otherwise there will be malformed XML documents.

Posted

when reading it does NOT substitute them back.

 

Shouldn't be common behaviour that correctly encoded special characters cannot be properly decoded again... 

  • 2 weeks later...
Posted

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

  • 10 months later...
Posted

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 <"

Posted
Sorry for the late reply.

 

 

hey sebastianbah, no need for excuses, answer only took less than a year... :rolleyes:

×
×
  • Create New...