From 81296e0c8e99ff6a80d317701b9bee15849c9a94 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 15 Feb 2017 18:52:17 -0800 Subject: [PATCH] Define xml-char? and use it in favor of unicode-char?. --- src/xml/xml-chars.scm | 3 +++ src/xml/xml-struct.scm | 8 +++----- src/xml/xml.pkg | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) 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 -- 2.25.1