Update of /project/cxml/cvsroot/cxml/xml
In directory clnet:/tmp/cvs-serv32067/xml
Modified Files:
package.lisp unparse.lisp
Log Message:
- Define CXML:ATTRIBUTE as a generic function, and a method for integers.
- Define /UTF8 sinks even on Unicode-aware implementations for backward-
compatibility. (Undocumented feature.)
--- /project/cxml/cvsroot/cxml/xml/package.lisp 2006/08/20 13:58:31 1.12
+++ /project/cxml/cvsroot/cxml/xml/package.lisp 2006/12/02 13:21:37 1.13
@@ -43,8 +43,11 @@
#:make-rod-sink
#+rune-is-character #:make-string-sink
#+rune-is-character #:make-character-stream-sink
- #-rune-is-character #:make-string-sink/utf8
- #-rune-is-character #:make-character-stream-sink/utf8
+ ;; See comment in runes/package.lisp
+ ;; #-rune-is-character
+ #:make-string-sink/utf8
+ ;; #-rune-is-character
+ #:make-character-stream-sink/utf8
#:with-xml-output
#:with-element
--- /project/cxml/cvsroot/cxml/xml/unparse.lisp 2006/08/28 13:41:41 1.11
+++ /project/cxml/cvsroot/cxml/xml/unparse.lisp 2006/12/02 13:21:37 1.12
@@ -95,8 +95,8 @@
:adjustable t
:fill-pointer 0))
-;; total haesslich, aber die ystreams will ich im moment eigentlich nicht
-;; dokumentieren
+;; bisschen unschoen hier die ganze api zu duplizieren, aber die
+;; ystreams sind noch undokumentiert
(macrolet ((define-maker (make-sink make-ystream &rest args)
`(defun ,make-sink (,@args &rest initargs)
(apply #'make-instance
@@ -110,10 +110,10 @@
#+rune-is-character
(define-maker make-character-stream-sink make-character-stream-ystream stream)
- #-rune-is-character
+ ;; #-rune-is-character
(define-maker make-string-sink/utf8 make-string-ystream/utf8)
- #-rune-is-character
+ ;; #-rune-is-character
(define-maker make-character-stream-sink/utf8
make-character-stream-ystream/utf8
stream))
@@ -539,11 +539,22 @@
(maybe-emit-start-tag)
(sax:end-element *sink* nil nil qname))))
-(defun attribute (name value)
+(defun attribute-1 (name value)
(push (sax:make-attribute :qname (rod name) :value (rod value))
(cdr *current-element*))
value)
+(defgeneric attribute (name value))
+
+(defmethod attribute (name (value string))
+ (attribute-1 name value))
+
+(defmethod attribute (name (value null))
+ (declare (ignore name)))
+
+(defmethod attribute (name (value integer))
+ (attribute-1 name (write-to-string value)))
+
(defun cdata (data)
(maybe-emit-start-tag)
(sax:start-cdata *sink*)