Commit bd17380d authored by david's avatar david

Revision: cxml--devel--1.0--patch-75

Archive: david@knowledgetools.de--cxml
Creator: David Lichteblau <david@knowledgetools.de>
Date: Fri Feb  6 22:01:18 CET 2004
Standard-date: 2004-02-06 21:01:18 GMT
Modified-files: xml/dom-builder.lisp
New-patches: david@knowledgetools.de--cxml/cxml--devel--1.0--patch-75
Summary: fixed PARENT slot initialization and added a rant about the current implementation

fixed PARENT slot initialization and added a rant about the current implementation
parent 574f013a
;;; XXX this DOM builder knows too much about the specifics of the DOM
;;; implementation for my taste. While document creation is not specified
;;; by the DOM Level 1 spec, we shouldn't really be manually setting slots
;;; in other nodes IMHO.
;;;
;;; As a follow-up to that, the children list is created in the wrong order
;;; and then reversed. Is it really worth the improved speed to do this?
;;; Calling APPEND-NODE would be portable.
;;;
;;; In particular, that design choice has lead to other bugs, for example the
;;; PARENT slot has to be set manually, too. A DOM test finally showed
;;; that this had been forgotten for Text nodes and PIs.
;;;
;;; Opinions?
;;;
;;; -- David
(in-package :dom-impl)
(export 'dom-builder)
......@@ -45,15 +62,21 @@
(defmethod sax:characters ((handler dom-builder) data)
(with-slots (document element-stack) handler
(let ((node (cdom:create-text-node document data)))
(let ((node (cdom:create-text-node document data))
(parent (car element-stack)))
(setf (slot-value node 'dom-impl::parent) parent)
(push node (slot-value (car element-stack) 'dom-impl::children)))))
(defmethod sax:processing-instruction ((handler dom-builder) target data)
(with-slots (document element-stack) handler
(let ((node (cdom:create-processing-instruction document target data)))
(let ((node (cdom:create-processing-instruction document target data))
(parent (car element-stack)))
(setf (slot-value node 'dom-impl::parent) parent)
(push node (slot-value (car element-stack) 'dom-impl::children)))))
(defmethod sax:comment ((handler dom-builder) data)
(with-slots (document element-stack) handler
(let ((node (cdom:create-comment document data)))
(let ((node (cdom:create-comment document data))
(parent (car element-stack)))
(setf (slot-value node 'dom-impl::parent) parent)
(push node (slot-value (car element-stack) 'dom-impl::children)))))
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