Try xmls make-xmlrep
I installed xmls when I installed Quicklisp at the first time. I tested this.
XMLS Documents
I found this site, http://www.quicklisp.org/beta/UNOFFICIAL/docs/xmls/doc/index.html. This seems to be UNOFFICIAL document. I found this site too, xmls | Quickdocs. Is this official site? I have no idea.
Preparation
? (defpackage "xml-sample" (:use "XMLS" "COMMON-LISP" "CCL")) ? (in-package "xml-sample")
Step1
? (make-xmlrep "Element1" :attribs "name" :children "Element2") ("Element1" "name" . "Element2") ? (xmls:write-xml (xmls:make-xmlrep "Element1" :attribs "name" :children "Element2") *standard-output*) <Element1 > Error: The value "name" is not of the expected type LIST. > While executing: XMLS::GENERATE-XML, in process listener(1). > Type :POP to abort, :R for a list of available restarts. > Type :? for other options.
The key parameter attribs seems to require the list.
Step2
? (setf test-xml-a (xmls:make-xmlrep "Element1" :children "Element2")) ("Element1" NIL . "Element2") ? (xmls:write-xml test-xml-a *standard-output*) <Element1> > Error: The value "Element2" is not of the expected type LIST. > While executing: CCL::MAP1, in process listener(1). > Type :POP to abort, :R for a list of available restarts. > Type :? for other options.
The child elements should be a list.
Step3
? (setf test-xml-a (xmls:make-xmlrep "Element1" :children '("Element2" "Element3"))) ("Element1" NIL "Element2" "Element3") ? (xmls:write-xml test-xml-a *standard-output*) <Element1>Element2Element3</Element1> NIL
According to this result, child keyword value means Element1 value. If required nested elements, create child elements before parent element create.
Step4
? (setf test-xml-a (make-xmlrep "ElementA" :children '("ValueA"))) ("ElementA" NIL "ValueA") ? (setf test-xml-b (make-xmlrep "ElementB" :children '("ValueB"))) ("ElementB" NIL "ValueB") ? (setf parent-element (make-xmlrep "Parents" :children '(test-xml-a test-xml-b))) ("Parents" NIL TEST-XML-A TEST-XML-B) ? (write-xml parent-element *standard-output*) <Parents>TEST-XML-ATEST-XML-B</Parents> NIL
According to this result, my assumption was not correct. What function enable to write a nested xml by xmls? I have not tried yet, make-node or xmlrep-add-child! is the one, perhaps. I will try next time.