[cxml-cvs] CVS cxml/xml
dlichteblau
dlichteblau at common-lisp.net
Sun Nov 18 18:43:11 UTC 2007
Update of /project/cxml/cvsroot/cxml/xml
In directory clnet:/tmp/cvs-serv28989/xml
Modified Files:
package.lisp sax-handler.lisp unparse.lisp
Log Message:
cxml:unescaped, sax:unescaped
--- /project/cxml/cvsroot/cxml/xml/package.lisp 2007/10/14 17:50:11 1.20
+++ /project/cxml/cvsroot/cxml/xml/package.lisp 2007/11/18 18:43:11 1.21
@@ -61,6 +61,9 @@
#:cdata
#:text
#:doctype
+ #:processing-instruction
+ #:comment
+ #:unescaped
#:xml-parse-error
#:well-formedness-violation
--- /project/cxml/cvsroot/cxml/xml/sax-handler.lisp 2007/10/21 14:43:20 1.13
+++ /project/cxml/cvsroot/cxml/xml/sax-handler.lisp 2007/11/18 18:43:11 1.14
@@ -64,6 +64,7 @@
#:start-prefix-mapping
#:start-element
#:characters
+ #:unescaped
#:processing-instruction
#:end-element
#:end-prefix-mapping
@@ -326,6 +327,10 @@
(data)
(hax:characters handler data))
+ (define-event (unescaped default-handler)
+ (data)
+ (hax:unescaped handler data))
+
(define-event (processing-instruction default-handler)
(target data)
nil)
@@ -461,6 +466,9 @@
(defmethod hax:characters ((handler abstract-handler) data)
(sax:characters handler data))
+(defmethod hax:unescaped ((handler abstract-handler) data)
+ (sax:unescaped handler data))
+
(defmethod hax:comment ((handler abstract-handler) str)
(sax:comment handler str))
@@ -515,6 +523,9 @@
It is possible that the character content of an element is reported
via multiple subsequent calls to this generic function.")
+(setf (documentation 'unescaped 'function)
+ "Called for unescaped element content. Beware dragons.")
+
(setf (documentation 'processing-instruction 'function)
"Called when a processing instruction is read.
--- /project/cxml/cvsroot/cxml/xml/unparse.lisp 2007/10/21 17:07:23 1.22
+++ /project/cxml/cvsroot/cxml/xml/unparse.lisp 2007/11/18 18:43:11 1.23
@@ -459,6 +459,10 @@
(loop for c across data do (unparse-datachar c y))
(loop for c across data do (unparse-datachar-readable c y))))))))
+(defmethod sax:unescaped ((sink sink) data)
+ (maybe-close-tag sink)
+ (%write-rod data sink))
+
(defmethod sax:comment ((sink sink) data)
(maybe-close-tag sink)
(unless (canonical sink)
@@ -682,3 +686,17 @@
(maybe-emit-start-tag)
(sax:characters *sink* (rod data))
data)
+
+(defun comment (data)
+ (maybe-emit-start-tag)
+ (sax:comment *sink* (rod data))
+ data)
+
+(defun processing-instruction (target data)
+ (maybe-emit-start-tag)
+ (sax:processing-instruction *sink* (rod target) (rod data))
+ data)
+
+(defun unescaped (str)
+ (maybe-emit-start-tag)
+ (sax:unescaped *sink* (rod str)))
More information about the Cxml-cvs
mailing list