From e46ea88a23d4db646de5f90a0c0e2a56c25bbd6b Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 19 Dec 2005 04:11:32 +0000 Subject: [PATCH] Change XML->STRING to use string output ports and to support coding. --- v7/src/xml/xml-output.scm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/v7/src/xml/xml-output.scm b/v7/src/xml/xml-output.scm index 93011c937..72b789b62 100644 --- a/v7/src/xml/xml-output.scm +++ b/v7/src/xml/xml-output.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: xml-output.scm,v 1.36 2005/12/13 15:30:33 cph Exp $ +$Id: xml-output.scm,v 1.37 2005/12/19 04:11:32 cph Exp $ Copyright 2001,2002,2003,2004,2005 Massachusetts Institute of Technology @@ -37,6 +37,17 @@ USA. (set-coding xml port) (write-xml-1 xml port options)))) +(define (xml->string xml . options) + (call-with-output-string + (lambda (port) + (set-coding xml port) + (write-xml-1 xml port options)))) + +(define (xml->wide-string xml . options) + (call-with-wide-output-string + (lambda (port) + (write-xml-1 xml port options)))) + (define (set-coding xml port) (let ((coding (or (normalize-coding port @@ -48,14 +59,6 @@ USA. (if (coding-requires-bom? coding) (write-char #\U+FEFF port)))) -(define (xml->wide-string xml . options) - (call-with-wide-output-string - (lambda (port) - (write-xml-1 xml port options)))) - -(define (xml->string xml . options) - (wide-string->utf8-string (apply xml->wide-string xml options))) - (define (write-xml-1 xml port options) (%write-xml xml (apply make-ctx -- 2.25.1