From: Chris Hanson Date: Sat, 7 Dec 2002 04:14:19 +0000 (+0000) Subject: Don't discard XML comments; these are important to preserve when X-Git-Tag: 20090517-FFI~2120 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=fec0ec5df1f8c196d590af43a9e6ae1d02e089a9;p=mit-scheme.git Don't discard XML comments; these are important to preserve when processing documents. --- diff --git a/v7/src/xml/load.scm b/v7/src/xml/load.scm index 6407aabc6..cecb14631 100644 --- a/v7/src/xml/load.scm +++ b/v7/src/xml/load.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: load.scm,v 1.6 2002/11/20 19:46:27 cph Exp $ +;;; $Id: load.scm,v 1.7 2002/12/07 04:13:39 cph Exp $ ;;; ;;; Copyright (c) 2001, 2002 Massachusetts Institute of Technology ;;; @@ -26,4 +26,4 @@ (with-working-directory-pathname (directory-pathname (current-load-pathname)) (lambda () (package/system-loader "xml" '() 'QUERY))) -(add-subsystem-identification! "XML" '(0 2)) \ No newline at end of file +(add-subsystem-identification! "XML" '(0 3)) \ No newline at end of file diff --git a/v7/src/xml/xml-output.scm b/v7/src/xml/xml-output.scm index 8b63d52b5..d6934fc46 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.2 2002/11/20 19:46:27 cph Exp $ +;;; $Id: xml-output.scm,v 1.3 2002/12/07 04:13:58 cph Exp $ ;;; -;;; Copyright (c) 2001 Massachusetts Institute of Technology +;;; Copyright (c) 2001, 2002 Massachusetts Institute of Technology ;;; ;;; This file is part of MIT Scheme. ;;; @@ -69,7 +69,12 @@ (write-string "" port)) - (write-string "/>" port)))) + (write-string " />" port)))) + +(define-method write-xml ((pi xml-comment-rtd) port) + (write-string "" port)) (define-method write-xml ((pi xml-processing-instructions-rtd) port) (write-string "")) (define parse-comment ;[15] - (let ((match-body - (terminated-region-matcher "comment" alphabet:xml-char "--"))) + (let ((parse-body + (terminated-region-parser "comment" alphabet:xml-char "--"))) (*parser - (sbracket "comment" "" - (noise match-body))))) + (encapsulate + (lambda (v) + (make-xml-comment (vector-ref v 0))) + (sbracket "comment" "" + parse-body))))) (define parse-cdata-section ;[18,19,20,21] (bracketed-region-parser "CDATA section" "")) diff --git a/v7/src/xml/xml-struct.scm b/v7/src/xml/xml-struct.scm index 8b0c2f343..e12064f9c 100644 --- a/v7/src/xml/xml-struct.scm +++ b/v7/src/xml/xml-struct.scm @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: xml-struct.scm,v 1.6 2002/11/20 19:46:27 cph Exp $ +;;; $Id: xml-struct.scm,v 1.7 2002/12/07 04:14:19 cph Exp $ ;;; -;;; Copyright (c) 2001 Massachusetts Institute of Technology +;;; Copyright (c) 2001, 2002 Massachusetts Institute of Technology ;;; ;;; This file is part of MIT Scheme. ;;; @@ -51,6 +51,10 @@ attributes contents) +(define-structure (xml-comment + (type-descriptor xml-comment-rtd)) + text) + (define-structure (xml-processing-instructions (type-descriptor xml-processing-instructions-rtd) (print-procedure diff --git a/v7/src/xml/xml.pkg b/v7/src/xml/xml.pkg index 5c4766888..e97d28ad6 100644 --- a/v7/src/xml/xml.pkg +++ b/v7/src/xml/xml.pkg @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: xml.pkg,v 1.10 2002/11/20 19:46:27 cph Exp $ +;;; $Id: xml.pkg,v 1.11 2002/12/07 04:13:49 cph Exp $ ;;; -;;; Copyright (c) 2001 Massachusetts Institute of Technology +;;; Copyright (c) 2001, 2002 Massachusetts Institute of Technology ;;; ;;; This file is part of MIT Scheme. ;;; @@ -38,6 +38,7 @@ make-xml-!element make-xml-!entity make-xml-!notation + make-xml-comment make-xml-declaration make-xml-document make-xml-dtd @@ -55,6 +56,7 @@ set-xml-!entity-value! set-xml-!notation-id! set-xml-!notation-name! + set-xml-comment-text! set-xml-declaration-encoding! set-xml-declaration-standalone! set-xml-declaration-version! @@ -96,6 +98,9 @@ xml-!notation-name xml-!notation-rtd xml-!notation? + xml-comment-rtd + xml-comment-text + xml-comment? xml-declaration-encoding xml-declaration-rtd xml-declaration-standalone