[fpc-devel] xml line endings
Vincent Snijders
vsnijders at quicknet.nl
Sun Jun 4 18:02:44 CEST 2006
Colin Western wrote:
> 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.
OK. Thanks, for looking that up.
So that means that external files may have all common line endings, but
after parsing it should #A.
Then I have no problem with the patch.
Thanks for the clarification.
Vincent
More information about the fpc-devel
mailing list