Change XML->STRING to use string output ports and to support coding.
authorChris Hanson <org/chris-hanson/cph>
Mon, 19 Dec 2005 04:11:32 +0000 (04:11 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 19 Dec 2005 04:11:32 +0000 (04:11 +0000)
v7/src/xml/xml-output.scm

index 93011c9379108bd5d0b3cb8a2bfb6e92637a302f..72b789b62b438ce01567183a314dab934cfc0e2f 100644 (file)
@@ -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