From: Chris Hanson Date: Sun, 15 Dec 2002 05:23:19 +0000 (+0000) Subject: Add new procedures: X-Git-Tag: 20090517-FFI~2106 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6c2bc63861209c5bc09386975dae0aa4e330ad0b;p=mit-scheme.git Add new procedures: READ-XML READ-XML-FILE WRITE-XML-FILE --- diff --git a/v7/src/xml/xml-output.scm b/v7/src/xml/xml-output.scm index c38be088f..9432737e0 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.8 2002/12/09 18:19:04 cph Exp $ +;;; $Id: xml-output.scm,v 1.9 2002/12/15 05:23:10 cph Exp $ ;;; ;;; Copyright (c) 2001, 2002 Massachusetts Institute of Technology ;;; @@ -25,6 +25,11 @@ (declare (usual-integrations)) +(define (write-xml-file xml pathname) + (call-with-output-file pathname + (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 a0042e016..b29498dee 100644 --- a/v7/src/xml/xml-parser.scm +++ b/v7/src/xml/xml-parser.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: xml-parser.scm,v 1.15 2002/12/09 19:03:38 cph Exp $ +;;; $Id: xml-parser.scm,v 1.16 2002/12/15 05:23:19 cph Exp $ ;;; ;;; Copyright (c) 2001, 2002 Massachusetts Institute of Technology ;;; @@ -94,6 +94,15 @@ ;;;; Top level +(define (read-xml-file pathname #!optional pi-handlers) + (call-with-input-file pathname + (lambda (port) + (read-xml port (if (default-object? pi-handlers) '() pi-handlers))))) + +(define (read-xml port #!optional pi-handlers) + (parse-xml-document (input-port->parser-buffer port) + (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 e97d28ad6..efe164086 100644 --- a/v7/src/xml/xml.pkg +++ b/v7/src/xml/xml.pkg @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: xml.pkg,v 1.11 2002/12/07 04:13:49 cph Exp $ +;;; $Id: xml.pkg,v 1.12 2002/12/15 05:23:03 cph Exp $ ;;; ;;; Copyright (c) 2001, 2002 Massachusetts Institute of Technology ;;; @@ -150,10 +150,13 @@ (files "xml-chars" "xml-parser") (parent (runtime xml)) (export () - parse-xml-document)) + parse-xml-document + read-xml + read-xml-file)) (define-package (runtime xml output) (files "xml-output") (parent (runtime xml)) (export () - write-xml)) \ No newline at end of file + write-xml + write-xml-file)) \ No newline at end of file