* Preserving EOL styles during SXML (de)serializing with xml->sxml/sxml->xml
@ 2022-02-01 10:19 Daniel Meißner
0 siblings, 0 replies; only message in thread
From: Daniel Meißner @ 2022-02-01 10:19 UTC (permalink / raw)
To: guile-user
[-- Attachment #1: Type: text/plain, Size: 197 bytes --]
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 #2: eol-guile.xml --]
[-- Type: application/octet-stream, Size: 139 bytes --]
<root>
<node>Text with Windows
line endings, that is, CRLF.</node>
<node>Text with UNIX
line endings, that is, LF.</node>
</root>
[-- Attachment #3: Type: text/plain, Size: 259 bytes --]
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:
[-- Attachment #4: eol-guile.scm --]
[-- Type: text/plain, Size: 214 bytes --]
(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 <>)))
[-- Attachment #5: Type: text/plain, Size: 170 bytes --]
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
happening?
Thanks,
Daniel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-01 10:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 10:19 Preserving EOL styles during SXML (de)serializing with xml->sxml/sxml->xml Daniel Meißner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).