From e94653c19b430a4414cb6795ed0587c98d588063 Mon Sep 17 00:00:00 2001
From: Chris Hanson <org/chris-hanson/cph>
Date: Fri, 7 Feb 2003 20:02:14 +0000
Subject: [PATCH] New procedures: STRING->XML, SUBSTRING->XML, and XML->STRING.

---
 v7/src/xml/xml-output.scm |  9 +++++++--
 v7/src/xml/xml-parser.scm | 12 ++++++++++--
 v7/src/xml/xml.pkg        |  9 ++++++---
 3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/v7/src/xml/xml-output.scm b/v7/src/xml/xml-output.scm
index 6686b8563..217808f2b 100644
--- a/v7/src/xml/xml-output.scm
+++ b/v7/src/xml/xml-output.scm
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Id: xml-output.scm,v 1.11 2003/01/26 06:35:34 cph Exp $
+$Id: xml-output.scm,v 1.12 2003/02/07 20:01:59 cph Exp $
 
-Copyright 2001,2002 Massachusetts Institute of Technology
+Copyright 2001,2002,2003 Massachusetts Institute of Technology
 
 This file is part of MIT Scheme.
 
@@ -31,6 +31,11 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     (lambda (port)
       (write-xml xml port))))
 
+(define (xml->string xml)
+  (with-string-output-port
+   (lambda (port)
+     (write-xml xml port))))
+
 (define-generic write-xml (object port))
 
 (define-method write-xml ((document xml-document-rtd) port)
diff --git a/v7/src/xml/xml-parser.scm b/v7/src/xml/xml-parser.scm
index 825e56420..4bbfef8d8 100644
--- a/v7/src/xml/xml-parser.scm
+++ b/v7/src/xml/xml-parser.scm
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Id: xml-parser.scm,v 1.18 2003/01/26 06:35:41 cph Exp $
+$Id: xml-parser.scm,v 1.19 2003/02/07 20:02:14 cph Exp $
 
-Copyright 2001,2002 Massachusetts Institute of Technology
+Copyright 2001,2002,2003 Massachusetts Institute of Technology
 
 This file is part of MIT Scheme.
 
@@ -104,6 +104,14 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   (parse-xml-document (input-port->parser-buffer port)
 		      (if (default-object? pi-handlers) '() pi-handlers)))
 
+(define (string->xml string #!optional pi-handlers)
+  (parse-xml-document (string->parser-buffer string)
+		      (if (default-object? pi-handlers) '() pi-handlers)))
+
+(define (substring->xml string start end #!optional pi-handlers)
+  (parse-xml-document (substring->parser-buffer string start end)
+		      (if (default-object? pi-handlers) '() pi-handlers)))
+
 (define (parse-xml-document buffer #!optional pi-handlers) ;[1,22]
   (if (not (parser-buffer? buffer))
       (error:wrong-type-argument buffer "parser buffer" 'PARSE-XML-DOCUMENT))
diff --git a/v7/src/xml/xml.pkg b/v7/src/xml/xml.pkg
index 18a236884..0738f883b 100644
--- a/v7/src/xml/xml.pkg
+++ b/v7/src/xml/xml.pkg
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: xml.pkg,v 1.14 2003/01/30 17:30:25 cph Exp $
+$Id: xml.pkg,v 1.15 2003/02/07 20:01:48 cph Exp $
 
 Copyright 2001,2002,2003 Massachusetts Institute of Technology
 
@@ -154,11 +154,14 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 	  char-set:xml-whitespace
 	  parse-xml-document
 	  read-xml
-	  read-xml-file))
+	  read-xml-file
+	  string->xml
+	  substring->xml))
 
 (define-package (runtime xml output)
   (files "xml-output")
   (parent (runtime xml))
   (export ()
 	  write-xml
-	  write-xml-file))
\ No newline at end of file
+	  write-xml-file
+	  xml->string))
\ No newline at end of file
-- 
2.25.1