From bf47a6208c4f600e85ef1c4a6d886befff5f8bfe Mon Sep 17 00:00:00 2001 From: david Date: Sun, 13 Mar 2005 18:02:19 +0000 Subject: [PATCH] Revision: cxml--devel--1.0--patch-80 Archive: david@knowledgetools.de--cxml Creator: David Lichteblau Date: Fri Feb 6 23:49:58 CET 2004 Standard-date: 2004-02-06 22:49:58 GMT Modified-files: xml/dom-builder.lisp xml/sax-handler.lisp xml/xml-parse.lisp New-patches: david@knowledgetools.de--cxml/cxml--devel--1.0--patch-80 Summary: noch unfertig: initialisiere dom:enitities richtig, erzeuge Entity-Knoten noch unfertig: initialisiere dom:enitities richtig, erzeuge Entity-Knoten --- xml/dom-builder.lisp | 12 +++++++++++- xml/sax-handler.lisp | 11 ++++++++++- xml/xml-parse.lisp | 15 ++++++++++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/xml/dom-builder.lisp b/xml/dom-builder.lisp index d6e6937..ebeba51 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 6ab74ab..b4518e4 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 e2a608a..ad3d263 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)))) -- GitLab