Update of /project/cxml/cvsroot/cxml/xml In directory common-lisp.net:/tmp/cvs-serv7494/xml
Modified Files: package.lisp recoder.lisp sax-handler.lisp sax-proxy.lisp xml-parse.lisp Added Files: space-normalizer.lisp Log Message: whitespace normalizer
Date: Thu Dec 29 01:31:36 2005 Author: dlichteblau
Index: cxml/xml/package.lisp diff -u cxml/xml/package.lisp:1.10 cxml/xml/package.lisp:1.11 --- cxml/xml/package.lisp:1.10 Thu Dec 29 00:18:05 2005 +++ cxml/xml/package.lisp Thu Dec 29 01:31:36 2005 @@ -77,5 +77,6 @@ #:sax-proxy #:proxy-chained-handler #:make-namespace-normalizer + #:make-whitespace-normalizer #:rod-to-utf8-string #:utf8-string-to-rod))
Index: cxml/xml/recoder.lisp diff -u cxml/xml/recoder.lisp:1.4 cxml/xml/recoder.lisp:1.5 --- cxml/xml/recoder.lisp:1.4 Tue Dec 27 02:35:20 2005 +++ cxml/xml/recoder.lisp Thu Dec 29 01:31:36 2005 @@ -118,4 +118,8 @@
(defwrapper sax:entity-resolver (resolver) - resolver)) + resolver) + + (defwrapper sax::dtd + (dtd) + dtd))
Index: cxml/xml/sax-handler.lisp diff -u cxml/xml/sax-handler.lisp:1.3 cxml/xml/sax-handler.lisp:1.4 --- cxml/xml/sax-handler.lisp:1.3 Sun Dec 4 21:35:18 2005 +++ cxml/xml/sax-handler.lisp Thu Dec 29 01:31:36 2005 @@ -53,6 +53,8 @@ #:*use-xmlns-namespace*
#:make-attribute + #:find-attribute + #:find-attribute-ns #:attribute-namespace-uri #:attribute-local-name #:attribute-qname @@ -137,6 +139,23 @@ value specified-p)
+(defun %rod= (x y) + ;; allow rods *and* strings *and* null + (cond + ((zerop (length x)) (zerop (length y))) + ((zerop (length y)) nil) + ((stringp x) (string= x y)) + (t (runes:rod= x y)))) + +(defun find-attribute (qname attrs) + (find qname attrs :key #'attribute-qname :test #'%rod=)) + +(defun find-attribute-ns (uri lname attrs) + (find-if (lambda (attr) + (and (%rod= uri (sax:attribute-namespace-uri attr)) + (%rod= lname (sax:attribute-local-name attr)))) + attrs)) + (defgeneric start-document (handler) (:documentation "Called at the beginning of the parsing process, before any element, processing instruction or comment is reported. @@ -325,7 +344,11 @@ (:documentation "Called between sax:end-dtd and sax:end-document to register an entity resolver, a function of two arguments: An entity name and SAX handler. - When called, the resolver function will parse the named entities data.") + When called, the resolver function will parse the named entity's data.") (:method ((handler t) resolver) (declare (ignore resolver)) nil)) + +;; internal for now +(defgeneric dtd (handler dtd) + (:method ((handler t) dtd) (declare (ignore dtd)) nil))
Index: cxml/xml/sax-proxy.lisp diff -u cxml/xml/sax-proxy.lisp:1.3 cxml/xml/sax-proxy.lisp:1.4 --- cxml/xml/sax-proxy.lisp:1.3 Mon Dec 12 00:56:52 2005 +++ cxml/xml/sax-proxy.lisp Thu Dec 29 01:31:36 2005 @@ -37,4 +37,5 @@ (define-proxy-method sax:notation-declaration (name public-id system-id)) (define-proxy-method sax:element-declaration (name model)) (define-proxy-method sax:attribute-declaration (elt attr type default)) - (define-proxy-method sax:entity-resolver (resolver))) + (define-proxy-method sax:entity-resolver (resolver)) + (define-proxy-method sax::dtd (dtd)))
Index: cxml/xml/xml-parse.lisp diff -u cxml/xml/xml-parse.lisp:1.57 cxml/xml/xml-parse.lisp:1.58 --- cxml/xml/xml-parse.lisp:1.57 Thu Dec 29 00:18:05 2005 +++ cxml/xml/xml-parse.lisp Thu Dec 29 01:31:36 2005 @@ -2513,7 +2513,8 @@ (let ((dtd (dtd *ctx*))) (sax:entity-resolver (handler *ctx*) - (lambda (name handler) (resolve-entity name handler dtd)))) + (lambda (name handler) (resolve-entity name handler dtd))) + (sax::dtd (handler *ctx*) dtd)) (list :DOCTYPE name extid))))
(defun report-cached-dtd (dtd)