While switching over from using xmls, I ran into a few problems with the
conversion. Xmls will convert non-string attributes and values to strings,
while cxml:map-node won't. Here's a patch to fix that.
: Daniel :
---
xml/xmls-compat.lisp | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/xml/xmls-compat.lisp b/xml/xmls-compat.lisp
index aa3d8bc..3804f8a 100644
--- a/xml/xmls-compat.lisp
+++ b/xml/xmls-compat.lisp
@@ -177,19 +177,21 @@
(defun map-node/qnames (handler node include-xmlns-attributes)
(sax:start-document handler)
(labels ((walk (node)
- (when (node-ns node)
- (error "serializing without :INCLUDE-NAMESPACE-URI, but node ~
+ (when (node-ns node)
+ (error "serializing without :INCLUDE-NAMESPACE-URI, but node ~
was created with a namespace URI"))
(let* ((attlist
- (compute-attributes/qnames node include-xmlns-attributes))
- (qname (string-rod (node-name node)))
+ (compute-attributes/qnames node
include-xmlns-attributes))
+ (qname (string-rod (node-name node)))
(lname (nth-value 1 (cxml::split-qname qname))))
(sax:start-element handler nil lname qname attlist)
(dolist (child (node-children node))
(typecase child
(list (walk child))
((or string rod)
- (sax:characters handler (string-rod child)))))
+ (sax:characters handler (string-rod child)))
+ (t
+ (sax:characters handler (string-rod (princ-to-string
child))))))
(sax:end-element handler nil lname qname))))
(walk node))
(sax:end-document handler))
@@ -212,7 +214,7 @@
(string-rod lname))
:local-name (string-rod lname)
:namespace-uri uri
- :value (string-rod value)
+ :value (string-rod (princ-to-string value))
:specified-p t))
(xmlnsp
(sax:make-attribute
@@ -222,7 +224,7 @@
"xmlns"))
:local-name (string-rod lname)
:namespace-uri uri
- :value (string-rod value)
+ :value (string-rod (princ-to-string value))
:specified-p t))))))
(node-attrs node))))
@@ -237,7 +239,7 @@
(if (or xmlnsp
(not (cxml::xmlns-attr-p (string-rod name))))
(sax:make-attribute :qname (string-rod name)
- :value (string-rod value)
+ :value (string-rod
(princ-to-string value))
:specified-p t)
nil)))
(node-attrs node))))
--
1.7.5.4