From: Chris Hanson Date: Mon, 19 Dec 2005 04:11:32 +0000 (+0000) Subject: Change XML->STRING to use string output ports and to support coding. X-Git-Tag: 20090517-FFI~1155 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e46ea88a23d4db646de5f90a0c0e2a56c25bbd6b;p=mit-scheme.git Change XML->STRING to use string output ports and to support coding. --- 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