carriage return in XML

Discussion in 'Mac Programming' started by scan, May 5, 2006.

  1. macrumors 6502

    Joined:
    Oct 24, 2005
    #1
    hey, anyone know what the carriage return in XML?
     
  2. Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Location:
    Los Angeles
    #2
    Space, carriage return, linefeed, and tab and considered "whitespace" in the syntax of XML tags, you can't simply put those characters in strings between tags.

    If you are trying to put these characters in the data you are representing in an XML document, you can put it between
    <![CDATA[​
    and
    ]]>​
    markers, e.g.,
    <![CDATA[
    This data is not parsed.
    ]]>​
    There may be other choices, but that depends on what software is reading the XML file for what purpose. You'd have to observe the encoding rules of that application.
     
  3. macrumors 6502a

    Joined:
    Jun 17, 2003
    #3
    Depending on how you are decoding the string, you might be able to get away with using the newline escape sequence '\n'. In C and Java when this is decoded as part of a string it will produce a newline character.
     
  4. macrumors 65816

    MarkCollette

    Joined:
    Mar 6, 2003
    Location:
    Calgary, Canada
    #4
    Carriage Return in UTF-8 XML: & # 13 ;
    Line Feed in UTF-8 XML: & # 10 ;

    But take out the spaces, so that the ampersand, pound sign, 13 and semicolon are right up against each other.
     

Share This Page