Menu

#121 double spaces are replaced with single space

open
nobody
None
5
2024-04-16
2011-08-10
crtmpserver
No

Hi,

I'm using tinyxml inside crtmpserver project (http://rtmpd.com/who-did-what/)

I discovered a problem. When de-serializing a XML, double spaces from text nodes are replaced with single spaces. Actually, any consecutive number of spaces are replaced with single space. The XML was generated using tinyxml. So, the serializer clearly stores them untouched. The deserializer should generate identical values, but is not doing that.

Here is a sample XML file:
http://pastebin.com/BByK1E1s

When deserialized, I get:
http://pastebin.com/YuF8nXHe

I also tested the XML with the w3c validator and the file is valid
http://www.w3schools.com/xml/xml_validator.asp

Best regards,
Andrei

Discussion

  • crtmpserver

    crtmpserver - 2011-08-10

    File serialized by tinyxml

     
  • zinga

    zinga - 2012-07-17

    I have made a patch for this bug. should I post it here or send it to leethompason ?
    Also, lee's email id given on the project page doesn't work anymore.

     
  • crtmpserver

    crtmpserver - 2012-07-17

    Never hurts to have it here as well. I would post it. When the author decides to include it, it will find it here. In the mean time, we could all benefit from it
    Thank you for your efforts :)

     
  • Helder "Lthere" Magalhães

    From tinyxml.h:

        /** The world does not agree on whether white space should be kept or
            not. In order to make everyone happy, these global, static functions
            are provided to set whether or not TinyXml will condense all white space
            into a single space or not. The default is to condense. Note changing this
            value is not thread safe.
        */
    

    So please read the documentation and consider using SetCondenseWhiteSpace to fix this "unexpected" behavior. Please close the issue unless the suggestion doesn't cover your use-case/behavior.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.