From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Daniel_Mei=C3=9Fner?= Newsgroups: gmane.lisp.guile.user Subject: Preserving EOL styles during SXML (de)serializing with xml->sxml/sxml->xml Date: Tue, 01 Feb 2022 11:19:09 +0100 Message-ID: <87y22u99eq.fsf@ruhr-uni-bochum.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39887"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Feb 01 11:20:33 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEqH3-000ABQ-Op for guile-user@m.gmane-mx.org; Tue, 01 Feb 2022 11:20:33 +0100 Original-Received: from localhost ([::1]:35990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEqH1-0001CI-Lb for guile-user@m.gmane-mx.org; Tue, 01 Feb 2022 05:20:32 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEqGC-000198-HI for guile-user@gnu.org; Tue, 01 Feb 2022 05:19:40 -0500 Original-Received: from out3.mail.ruhr-uni-bochum.de ([134.147.53.155]:18685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEqG9-0003ta-Un for guile-user@gnu.org; Tue, 01 Feb 2022 05:19:39 -0500 Original-Received: from mx3.mail.ruhr-uni-bochum.de (localhost [127.0.0.1]) by out3.mail.ruhr-uni-bochum.de (Postfix mo-ext) with ESMTP id 4Jp1BB54VWz8SPs for ; Tue, 1 Feb 2022 11:19:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ruhr-uni-bochum.de; s=mail-2017; t=1643710754; bh=2kiRkHZmZbN2kt9mcfK2Dt9SZK7BNk6E9BuePMe3Pfk=; h=From:To:Subject:Date:From; b=g8nK5kPdQOgDeriM9AXxuduNzRfPXyEcybNgpn8IpCMykbgcQL1LKACm0f3qZagdU jfAYoXZZs/WY7Jdsi9Hf/o2I7gdyUL6SJzGyDbz+vd67mViyy6r3ioAIAS79Wisxku 2U549sD8q5jnppbgbnbSHgeazcPmqU3Egg/521Sc= Original-Received: from out3.mail.ruhr-uni-bochum.de (localhost [127.0.0.1]) by mx3.mail.ruhr-uni-bochum.de (Postfix idis) with ESMTP id 4Jp1BB4PPVz8SPf for ; Tue, 1 Feb 2022 11:19:14 +0100 (CET) X-RUB-Notes: Internal origin=IPv6:2a05:3e00:c:1001::8693:2aec X-Envelope-Sender: Original-Received: from mail2.mail.ruhr-uni-bochum.de (mail2.mail.ruhr-uni-bochum.de [IPv6:2a05:3e00:c:1001::8693:2aec]) by out3.mail.ruhr-uni-bochum.de (Postfix mi-int) with ESMTP id 4Jp1BB2zMhz8SPL for ; Tue, 1 Feb 2022 11:19:14 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.104.1 at mx3.mail.ruhr-uni-bochum.de Original-Received: from think (dslb-002-207-030-240.002.207.pools.vodafone-ip.de [2.207.30.240]) by mail2.mail.ruhr-uni-bochum.de (Postfix) with ESMTPSA id 4Jp1B96WcszDgyd for ; Tue, 1 Feb 2022 11:19:13 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.104.1 at mail2.mail.ruhr-uni-bochum.de Received-SPF: pass client-ip=134.147.53.155; envelope-from=daniel.meissner-i4k@ruhr-uni-bochum.de; helo=out3.mail.ruhr-uni-bochum.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17980 Archived-At: --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: application/octet-stream; charset=utf-8 Content-Disposition: inline; filename=eol-guile.xml Content-Transfer-Encoding: base64 PHJvb3Q+CiAgPG5vZGU+VGV4dCB3aXRoIFdpbmRvd3MNCiAgbGluZSBlbmRpbmdzLCB0aGF0IGlz LCBDUkxGLjwvbm9kZT4KICA8bm9kZT5UZXh0IHdpdGggVU5JWAogIGxpbmUgZW5kaW5ncywgdGhh dCBpcywgTEYuPC9ub2RlPgo8L3Jvb3Q+Cg== --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=eol-guile.scm (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 <>))) --=-=-= Content-Type: text/plain 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 --=-=-=--