How embed Carriage Return inside Value string

Neal
2007-06-19
2013-05-20
  • 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:

    TEXT="start
    finish"

    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!
      noleander

     
    • weifeng tao

      weifeng tao - 2008-07-18

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

      <data>
      151,151
      149,149
      147,147
      </data>

      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:
      <comment>
      line 1
      line 2
      line 3
      </comment>

      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.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks