You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2.11 End-of-Line Handling
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.
I found golang xml library has below code for handling it.
// We must rewrite unescaped \r and \r\n into \n.if b == '\r'{
d.buf.WriteByte('\n')}elseif b1 == '\r' && b == '\n'{// Skip \r\n--we already wrote \n.}else{
d.buf.WriteByte(b)}
The text was updated successfully, but these errors were encountered:
Take this xml content for example, note: \r\n is used for line break.
And with below code to print Text event:
Output:
Expected output should not have \r:
Because as xml specification
I found golang xml library has below code for handling it.
The text was updated successfully, but these errors were encountered: