[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Preserving EOL styles during SXML (de)serializing with xml->sxml/sxml->x

From: Daniel Meißner
Subject: Preserving EOL styles during SXML (de)serializing with xml->sxml/sxml->xml
Date: Tue, 01 Feb 2022 11:19:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi Guile community!

First of all, thank you for the wonderful language you created.  It's
super fun for me to try to get stuff done using Guile.

Now to my problem: I have an XML file like this:

Attachment: eol-guile.xml
Description: Binary data

In this file there are elements that contain text nodes with CRLF
(Windows style EOL) and ones containing LF (UNIX style EOL).  I wish to
preserve the CRLF line endings.  However, the following little script
shows that they get lost during reading/parsing:

(use-modules (sxml simple)
             (srfi srfi-26))

(let ((sxml (call-with-input-file "eol-guile.xml" xml->sxml)))
  (write sxml)
  (call-with-output-file "eol-guile-written.xml"
    (cut sxml->xml sxml <>)))
After reading in the file and parsing it to SXML the CRLF is gone.  This
seems to happen during the SXML parsing.  How do I prevent this from


reply via email to

[Prev in Thread] Current Thread [Next in Thread]