[cxml-cvs] CVS cxml/klacks

dlichteblau dlichteblau at common-lisp.net
Tue May 1 18:21:42 UTC 2007


Update of /project/cxml/cvsroot/cxml/klacks
In directory clnet:/tmp/cvs-serv20218/klacks

Modified Files:
	klacks-impl.lisp klacks.lisp package.lisp tap-source.lisp 
Log Message:
klacks:get-attribute; dribbling source fix; FAQ


--- /project/cxml/cvsroot/cxml/klacks/klacks-impl.lisp	2007/04/22 13:23:55	1.8
+++ /project/cxml/cvsroot/cxml/klacks/klacks-impl.lisp	2007/05/01 18:21:41	1.9
@@ -102,6 +102,13 @@
 	     (sax:attribute-value a)
 	     (sax:attribute-specified-p a))))
 
+(defmethod klacks:get-attribute
+    ((source cxml-source) lname &optional uri)
+  (dolist (a (slot-value source 'current-attributes))
+    (when (and (equal (sax:attribute-local-name a) lname)
+	       (equal (sax:attribute-namespace-uri a) uri))
+      (return (sax:attribute-value a)))))
+
 (defmethod klacks:list-attributes ((source cxml-source))
   (slot-value source 'current-attributes))
 
--- /project/cxml/cvsroot/cxml/klacks/klacks.lisp	2007/04/22 13:23:55	1.7
+++ /project/cxml/cvsroot/cxml/klacks/klacks.lisp	2007/05/01 18:21:41	1.8
@@ -34,13 +34,13 @@
 
 (defgeneric klacks:map-attributes (fn source))
 (defgeneric klacks:list-attributes (source))
+(defgeneric klacks:get-attribute (source lname &optional uri))
 ;;;(defgeneric klacks:current-uri (source))
 ;;;(defgeneric klacks:current-lname (source))
 ;;;(defgeneric klacks:current-qname (source))
 ;;;(defgeneric klacks:current-characters (source))
 (defgeneric klacks:current-cdata-section-p (source))
 (defgeneric klacks:map-current-namespace-declarations (fn source))
-(defgeneric klacks:map-previous-namespace-declarations (fn source))
 
 (defgeneric klacks:current-line-number (source))
 (defgeneric klacks:current-column-number (source))
--- /project/cxml/cvsroot/cxml/klacks/package.lisp	2007/04/22 13:23:55	1.5
+++ /project/cxml/cvsroot/cxml/klacks/package.lisp	2007/05/01 18:21:41	1.6
@@ -37,6 +37,7 @@
 
 	   #:map-attributes
 	   #:list-attributes
+	   #:get-attribute
 	   #:current-uri
 	   #:current-lname
 	   #:current-qname
--- /project/cxml/cvsroot/cxml/klacks/tap-source.lisp	2007/04/22 13:23:55	1.1
+++ /project/cxml/cvsroot/cxml/klacks/tap-source.lisp	2007/05/01 18:21:41	1.2
@@ -26,7 +26,8 @@
 (defclass klacks:tapping-source (klacks:source)
     ((upstream-source :initarg :upstream-source :accessor upstream-source)
      (dribble-handler :initarg :dribble-handler :accessor dribble-handler)
-     (seen-event-p :initform nil :accessor seen-event-p)))
+     (seen-event-p :initform nil :accessor seen-event-p)
+     (document-done-p :initform nil :accessor document-done-p)))
 
 (defmethod initialize-instance :after ((instance klacks:tapping-source) &key)
   (let ((s-p (make-instance 'klacksax :source (upstream-source instance))))
@@ -36,7 +37,9 @@
 ;;; event dribbling 
 
 (defun maybe-dribble (source)
-  (unless (seen-event-p source)
+  (unless (or (seen-event-p source) (document-done-p source))
+    (when (eq (klacks:peek (upstream-source source)) :end-document)
+      (setf (document-done-p source) t))
     (klacks:serialize-event (upstream-source source)
 			    (dribble-handler source)
 			    :consume nil)




More information about the Cxml-cvs mailing list