Menu

CDATA issue

Developer
BlackEye
2007-12-04
2013-05-20
  • BlackEye

    BlackEye - 2007-12-04

    There is a CDATA parsing/output problem.  If multiple CDATA sections are next to each other, only the first will be parsed.  For example when the following node is parsed, only the "This is cdata" is returned.  The parser is stopping at the first ]]>, but it should concatenate these CDATA sections together.

    <node>
        <![CDATA[This is cdata]]><![CDATA[ This is more cdata]]>
    </node>

    Also, if I set a CDATA text element to something with a ]]> in it and then ouput the final XML, it should be broken up into multiple CDATA sections.  For example

    SAMPLE ]]> ANOTHER SAMPLE

    should become

    <![CDATA[SAMPLE ]]]]><![CDATA[> ANOTHER SAMPLE]]>

    Instead, it's just using the value verbatim.

    The first issue can be solved by placing a while loop in TiXmlText::Parse, to keep reading CDATA sections until there isn't any more.  The second will require more extensive changes in TiXmlPrinter::Visit.

     
    • Lee Thomason

      Lee Thomason - 2008-03-23

      Should be a bug - added to 'bugs' section.

      thanks,
      lee

       

Log in to post a comment.

MongoDB Logo MongoDB