Initial revision

This commit is contained in:
david
2005-03-13 18:02:10 +00:00
commit d6ca7664f4
81 changed files with 19663 additions and 0 deletions

46
dom/simple-dom.lisp Normal file
View File

@ -0,0 +1,46 @@
(in-package :xml)
;;; Implementation of a simple but faster DOM.
(defclass simple-document ()
((children :initform nil :accessor simple-document-children)))
(defstruct node
parent)
(defstruct (processing-instruction (:include node))
target
data)
(defstruct (text (:include node)
(:constructor make-text-boa (parent data)))
data)
(defstruct (element (:include node))
gi
attributes
children)
(defmethod dom:create-processing-instruction ((document simple-document) target data)
(make-processing-instruction :target target :data data))
(defmethod dom:append-child ((node element) child)
(setf (node-parent child) node)
(push child (element-children node)))
(defmethod dom:append-child ((node simple-document) child)
(push child (simple-document-children node))
nil)
(defmethod dom:create-element ((document simple-document) name)
(make-element :gi name))
(defmethod dom:set-attribute ((node element) name value)
(push (cons name value)
(element-attributes node)))
(defmethod dom:create-text-node ((document simple-document) data)
(make-text-boa nil data))
(defmethod dom:create-cdata-section ((document simple-document) data)
(make-text-boa nil data))