From: Chris Hanson Date: Thu, 16 Feb 2017 02:52:17 +0000 (-0800) Subject: Define xml-char? and use it in favor of unicode-char?. X-Git-Tag: mit-scheme-pucked-9.2.12~220^2~95 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=81296e0c8e99ff6a80d317701b9bee15849c9a94;p=mit-scheme.git Define xml-char? and use it in favor of unicode-char?. --- diff --git a/src/xml/xml-chars.scm b/src/xml/xml-chars.scm index 692698e3c..42996cd72 100644 --- a/src/xml/xml-chars.scm +++ b/src/xml/xml-chars.scm @@ -378,6 +378,9 @@ USA. (#xE000 . #xFFFE) (#x10000 . #x110000)))) +(define xml-char? + (char-set-predicate char-set:xml-char)) + (define char-set:char-data (char-set-difference char-set:xml-char (string->char-set "<&"))) diff --git a/src/xml/xml-struct.scm b/src/xml/xml-struct.scm index ad2ab2820..44804db2e 100644 --- a/src/xml/xml-struct.scm +++ b/src/xml/xml-struct.scm @@ -163,17 +163,15 @@ USA. (value canonicalize canonicalize-char-data)) (define (xml-char-data? object) - (or (unicode-char? object) + (or (xml-char? object) (and (ustring? object) (string-of-xml-chars? object)))) (define (string-of-xml-chars? string) - (ustring-every (char-set-predicate char-set:xml-char) string)) + (ustring-every xml-char? string)) (define (canonicalize-char-data object) - (cond ((unicode-char? object) - (if (not (char-in-set? object char-set:xml-char)) - (error:wrong-type-datum object "well-formed XML char data")) + (cond ((xml-char? object) (ustring object)) ((ustring? object) (if (not (string-of-xml-chars? object)) diff --git a/src/xml/xml.pkg b/src/xml/xml.pkg index 9c53b1dd9..68c9a743a 100644 --- a/src/xml/xml.pkg +++ b/src/xml/xml.pkg @@ -38,7 +38,8 @@ USA. (parent (runtime xml)) (export () char-set:xml-char - char-set:xml-whitespace) + char-set:xml-whitespace + xml-char?) (export (runtime xml) char-set:char-data char-set:name-initial