[fpc-devel] xml line endings
Colin Western
mftq75 at dsl.pipex.com
Sun Jun 4 17:55:20 CEST 2006
Vincent Snijders wrote:
> Hi,
>
> I saw in the log message of revision
> http://www.freepascal.org/cgi-bin/viewcvs.cgi?diff_format=l&rev=3784&sortby=date&view=rev
>
> that the xml units now use native line ending.
>
> Previously I noticed they were using #10 for line-ending and was told
> this was conform the xml specifications.
>
> Does this change mean, that valid xml files can only be generated on
> *nix from now on?
I submitted the change because I find it convenient to occasionally edit
the xml data files from my program as text, and (for example) notepad
does not like unix line endings. Looking at the spec:
<http://www.w3.org/TR/REC-xml/#sec-line-ends>
it says:
"XML parsed entities are often stored in computer files which, for
editing convenience, are organized into lines. These lines are typically
separated by some combination of the characters CARRIAGE RETURN (#xD)
and LINE FEED (#xA)."
"To simplify the tasks of applications, the XML processor MUST behave as
if it normalized all line breaks in external parsed entities (including
the document entity) on input, before parsing, by translating both the
two-character sequence #xD #xA and any #xD that is not followed by #xA
to a single #xA character."
which I read as allowing any line ending, and it is the reader's
responsibility to normalize the line ending.
Colin
More information about the fpc-devel
mailing list