diff --git a/xml/dom-builder.lisp b/xml/dom-builder.lisp index d6e6937a65ba8cd5e6a39d4958991203c29a895f..ebeba51b0bcf784b86561a9e6b3fc288d1c5384e 100644 --- a/xml/dom-builder.lisp +++ b/xml/dom-builder.lisp @@ -41,7 +41,8 @@ (let ((document (document handler)) (doctype (make-instance 'dom-impl::document-type :name name - :notations (make-hash-table :test #'equalp)))) + :notations (make-instance 'dom-impl::named-node-map) + :entities (make-instance 'dom-impl::named-node-map)))) (setf (slot-value doctype 'dom-impl::owner) document (slot-value document 'dom-impl::doc-type) doctype))) @@ -80,3 +81,12 @@ (parent (car element-stack))) (setf (slot-value node 'dom-impl::parent) parent) (push node (slot-value (car element-stack) 'dom-impl::children))))) + +(defmethod sax:unparsed-entity-declaration + ((handler dom-builder) name public-id system-id notation-name) + (dom:set-named-item (dom:entities (dom:doctype (document handler))) + (make-instance 'dom-impl::entity + :name name + :public-id public-id + :system-id system-id + :notation-name notation-name))) diff --git a/xml/sax-handler.lisp b/xml/sax-handler.lisp index 6ab74abd4a210f879e8b5d51369cfcfea64d787d..b4518e498bb71cf09a802fdc1421b3cf6d981ca7 100644 --- a/xml/sax-handler.lisp +++ b/xml/sax-handler.lisp @@ -70,7 +70,8 @@ #:start-cdata #:end-cdata #:start-dtd - #:end-dtd)) + #:end-dtd + #:unparsed-entity-declaration)) (in-package :sax) @@ -241,3 +242,11 @@ other textual content.") (defgeneric end-dtd (handler) (:documentation "Called at the end of parsing a DTD.") (:method ((handler t)) nil)) + +(defgeneric unparsed-entity-declaration + (handler name public-id system-id notation-name) + (:documentation + "Called when an entity declaration is seen while parsing a DTD.") + (:method ((handler t) name public-id system-id notation-name) + (declare (ignore name public-id system-id notation-name)) + nil)) diff --git a/xml/xml-parse.lisp b/xml/xml-parse.lisp index e2a608a97ee24e8535a060c4d98d414fa5af08b4..ad3d263c7374de11849666fb3d17ffda41155f7c 100644 --- a/xml/xml-parse.lisp +++ b/xml/xml-parse.lisp @@ -1567,6 +1567,15 @@ (p/S input) (setf def (p/entity-def input kind)) (define-entity input name kind def) + (when (eq kind :general) + ;; XXX wirklich nur :general? + ;; XXX was ist mit notation-name? + (ecase (car def) + (:EXTERNAL + ;; XXX hier fehlen public-id und system-id + (sax:unparsed-entity-declaration *handler* name nil nil nil)) + (:INTERNAL + (sax:unparsed-entity-declaration *handler* name nil nil nil)))) (p/S? input) (expect input :\>))) @@ -1883,6 +1892,9 @@ (eq (peek-token input) :\> )) (setf extid (p/external-id input t)))) (p/S? input) + (ecase (car extid) + (:PUBLIC (sax:start-dtd *handler* name (cadr extid) (caddr extid))) + (:SYSTEM (sax:start-dtd *handler* name nil (cadr extid)))) (when (eq (peek-token input) :\[ ) (consume-token input) (while (progn (p/S? input) @@ -1902,9 +1914,6 @@ (consume-token input) (p/S? input)) (expect input :>) - (ecase (car extid) - (:PUBLIC (sax:start-dtd *handler* name (cadr extid) (caddr extid))) - (:SYSTEM (sax:start-dtd *handler* name nil (cadr extid)))) (when extid (let* ((xi2 (open-extid (absolute-extid input extid))) (zi2 (make-zstream :input-stack (list xi2))))