How embed Carriage Return inside Value string

  • Neal

    Neal - 2007-06-19

    I need to store a string in XML, and I want to preserve Carriage returns and Line Feeds.  What is the normal way of doing this?   Say I have the string (in my program) as:

    "Start \n  Finish"

    My understanding is that CRs cannot be inside the string itself in XML as in:


    because the CR is just treated as white space and will be skipped when reading.  Or is the above legitimate?

    Should I use the &#10  and &#13  ? as in:

    TEXT="Start &#10 Finish"

    Or is there some other standard way of doing this?

    Thanks in advance!

    • weifeng tao

      weifeng tao - 2008-07-18

      I have the same problem, I want to have text like


      I can not find a way to do that in tinyXML, anybody can help?

    • Khalil

      Khalil - 2009-04-06

      Same problem. I have an XML file like this one:
      line 1
      line 2
      line 3

      When I read the XML file the Carriage Returns are not treated. I tried to use the &#x000D; character and it worked but it's not very interesting.

      Why the XMLSpy editor recognizes these characters but not TinyXml ?


Log in to post a comment.