Commit b36ac3fd authored by david's avatar david

Revision: cxml--devel--1.0--patch-58

Archive: david@knowledgetools.de--cxml
Creator: David Lichteblau <david@knowledgetools.de>
Date: Thu Feb  5 23:04:58 CET 2004
Standard-date: 2004-02-05 22:04: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-58
Summary: START-DTD, END-DTD, DOCUMENT-TYPE initialisation
Keywords:

  - Added SAX:START-DTD and SAX:END-DTD.
  - Create DOCUMENT-TYPE only when appropriate.  It must be NIL otherwise.
  - Intialize its NAME.
parent da0ff41c
...@@ -7,11 +7,9 @@ ...@@ -7,11 +7,9 @@
(element-stack :initform '() :accessor element-stack))) (element-stack :initform '() :accessor element-stack)))
(defmethod sax:start-document ((handler dom-builder)) (defmethod sax:start-document ((handler dom-builder))
(let ((document (make-instance 'dom-impl::document)) (let ((document (make-instance 'dom-impl::document)))
(doctype (make-instance 'dom-impl::document-type
:notations (make-hash-table :test #'equalp))))
(setf (slot-value document 'dom-impl::owner) document (setf (slot-value document 'dom-impl::owner) document
(slot-value document 'dom-impl::doc-type) doctype) (slot-value document 'dom-impl::doc-type) nil)
(setf (document handler) document) (setf (document handler) document)
(push document (element-stack handler)))) (push document (element-stack handler))))
...@@ -21,6 +19,15 @@ ...@@ -21,6 +19,15 @@
(setf (slot-value (document handler) 'entities) xml::*entities*) (setf (slot-value (document handler) 'entities) xml::*entities*)
(document handler)) (document handler))
(defmethod sax:start-dtd ((handler dom-builder) name publicid systemid)
(declare (ignore publicid systemid))
(let ((document (document handler))
(doctype (make-instance 'dom-impl::document-type
:name name
:notations (make-hash-table :test #'equalp))))
(setf (slot-value doctype 'dom-impl::owner) document
(slot-value document 'dom-impl::doc-type) doctype)))
(defmethod sax:start-element ((handler dom-builder) namespace-uri local-name qname attributes) (defmethod sax:start-element ((handler dom-builder) namespace-uri local-name qname attributes)
(with-slots (document element-stack) handler (with-slots (document element-stack) handler
(let ((element (cdom:create-element document qname)) (let ((element (cdom:create-element document qname))
......
...@@ -68,7 +68,9 @@ ...@@ -68,7 +68,9 @@
#:end-document #:end-document
#:comment #:comment
#:start-cdata #:start-cdata
#:end-cdata)) #:end-cdata
#:start-dtd
#:end-dtd))
(in-package :sax) (in-package :sax)
...@@ -229,3 +231,13 @@ lexical structure of the parsed document. The content of the CDATA ...@@ -229,3 +231,13 @@ lexical structure of the parsed document. The content of the CDATA
section is reported via the `characters' generic function like all section is reported via the `characters' generic function like all
other textual content.") other textual content.")
(:method ((handler t)) nil)) (:method ((handler t)) nil))
(defgeneric start-dtd (handler name public-id system-id)
(:documentation "Called at the beginning of parsing a DTD.")
(:method ((handler t) name public-id system-id)
(declare (ignore name public-id system-id))
nil))
(defgeneric end-dtd (handler)
(:documentation "Called at the end of parsing a DTD.")
(:method ((handler t)) nil))
...@@ -1902,11 +1902,15 @@ ...@@ -1902,11 +1902,15 @@
(consume-token input) (consume-token input)
(p/S? input)) (p/S? input))
(expect 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 (when extid
(let* ((xi2 (open-extid (absolute-extid input extid))) (let* ((xi2 (open-extid (absolute-extid input extid)))
(zi2 (make-zstream :input-stack (list xi2)))) (zi2 (make-zstream :input-stack (list xi2))))
(let () (let ()
(p/ext-subset zi2)))) (p/ext-subset zi2))))
(sax:end-dtd *handler*)
(list :DOCTYPE name extid)))) (list :DOCTYPE name extid))))
(defun p/misc*-2 (input) (defun p/misc*-2 (input)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment