#51 Incorrect entity encoding, results in invalid XML

open
nobody
None
5
2013-12-21
2010-07-19
Tim Kosse
No

TinyXML incorrectly encodes text element containing an ampersand followed by either x or #:

Example: <foo>foo&amp;#xa+bar</foo>
The text gets decoded properly to: foo&#xa+bar
Yet when saving that very same XML document unmodified, the result is: <foo>foo&#xa+bar</foo>

This is clearly incorrect behavior and actually results in incorrect XML.

I have attached a patch that contains both a fix as well as an updated xmltest.cpp

Patch is against a fresh CVS checkout made on 2010-07-19 21:00 UTC

Discussion

  • Tim Kosse
    Tim Kosse
    2010-07-19

     
    Attachments
  • XhmikosR
    XhmikosR
    2011-05-15

    Is there any reason why this patch wasn't included in v2.6.2?

    I can reproduce the bug with the latest version 2.6.2 in another project we use TinyXML and I can confirm that botg's patch fixes it.

     
  • I am building the cvs version of filezilla and have had to install the Fedora 19 version of TinyXML. Here are the "current" versions of TinyXML from the Fedora 19 repositories. Should I make a bug report about this problem with them?

    rpm -qa | grep tinyxml
    tinyxml2-1.0.11-3.20130805git0323851.fc19.x86_64
    tinyxml2-devel-1.0.11-3.20130805git0323851.fc19.x86_64
    tinyxml-devel-2.6.2-1.fc19.x86_64
    tinyxml-2.6.2-1.fc19.x86_64