Quoting Nunez Steve (steve_nunez@yahoo.com):
A follow-up question: Is there a way to emit a newline into the file? It would help in readability of some parts.
Unless the sink is in canonical mode (and canonical isn't the default anymore in current cxml), newline characters in text are written literally, so just write text including a newline. Example:
CL-USER> (cxml:with-xml-output (cxml:make-string-sink) (cxml:with-element "test" (cxml:text (format nil "foo~%bar")))) "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <test>foo bar</test>"
That's for manual breaks. If you were hoping for automatic indentation, there's the :INDENTATION keyword argument:
CL-USER> (cxml:with-xml-output (cxml:make-string-sink :indentation 2) (cxml:with-element "outer" (cxml:with-element "inner" (cxml:text (format nil "foo~%bar"))))) "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <outer> <inner> foo bar</inner> </outer>"
The indentation support isn't very good though. I use it only for debugging purposes. Also note that it reindents texts, removing the explicit newline.
d.