Update of /project/cxml/cvsroot/cxml/dom In directory common-lisp.net:/tmp/cvs-serv31040/dom
Modified Files: dom-impl.lisp unparse.lisp Log Message: namespace normalization
Date: Mon Dec 12 00:56:51 2005 Author: dlichteblau
Index: cxml/dom/dom-impl.lisp diff -u cxml/dom/dom-impl.lisp:1.31 cxml/dom/dom-impl.lisp:1.32 --- cxml/dom/dom-impl.lisp:1.31 Sun Dec 11 21:13:05 2005 +++ cxml/dom/dom-impl.lisp Mon Dec 12 00:56:48 2005 @@ -50,18 +50,6 @@ (dom:namespace-uri node))) (setf (slot-value node 'prefix) newval))
-(defmethod (setf dom:prefix) :before (newval (node attribute)) - (when (rod= (dom:node-name node) #"xmlns") - (dom-error :NAMESPACE_ERR "must not change xmlns attribute prefix"))) - -(defmethod (setf dom:prefix) :after (newval (node attribute)) - (setf (slot-value node 'name) - (concatenate 'rod newval #":" (dom:local-name node)))) - -(defmethod (setf dom:prefix) :after (newval (node element)) - (setf (slot-value node 'tag-name) - (concatenate 'rod newval #":" (dom:local-name node)))) - (defclass document (node) ((doc-type :initarg :doc-type :reader dom:doctype) (dtd :initform nil :reader dtd) @@ -78,6 +66,14 @@ (owner-element :initarg :owner-element :reader dom:owner-element) (specified-p :initarg :specified-p :reader dom:specified)))
+(defmethod (setf dom:prefix) :before (newval (node attribute)) + (when (rod= (dom:node-name node) #"xmlns") + (dom-error :NAMESPACE_ERR "must not change xmlns attribute prefix"))) + +(defmethod (setf dom:prefix) :after (newval (node attribute)) + (setf (slot-value node 'name) + (concatenate 'rod newval #":" (dom:local-name node)))) + (defmethod print-object ((object attribute) stream) (print-unreadable-object (object stream :type t :identity t) (format stream "~A=~S" @@ -87,6 +83,10 @@ (defclass element (namespace-mixin node) ((tag-name :initarg :tag-name :reader dom:tag-name) (attributes :initarg :attributes :reader dom:attributes))) + +(defmethod (setf dom:prefix) :after (newval (node element)) + (setf (slot-value node 'tag-name) + (concatenate 'rod newval #":" (dom:local-name node))))
(defmethod print-object ((object element) stream) (print-unreadable-object (object stream :type t :identity t)
Index: cxml/dom/unparse.lisp diff -u cxml/dom/unparse.lisp:1.2 cxml/dom/unparse.lisp:1.3 --- cxml/dom/unparse.lisp:1.2 Sun Dec 4 19:43:56 2005 +++ cxml/dom/unparse.lisp Mon Dec 12 00:56:51 2005 @@ -1,6 +1,8 @@ (in-package :cxml)
(defun %unparse-document (sink doc canonical) + (when sax:*namespace-processing* + (setf sink (cxml:make-namespace-normalizer sink))) (dom:map-document sink doc :include-doctype (if (and canonical (>= canonical 2))