2010/5/31 Frederico Muñoz fsmunoz@gmail.com:
- As it is write-to-xml defaults to *standard-output*. It seems
sensible to me to do so, and one can always provide a different stream. The tutorial, however, seems to indicate that write-to-xml should return the XML output as a return value... not sure if adapting the tutorial is the best course, or changing the way write-to-xml works by using a string stream and returning the output (I've tried, it works, but returns everything escaped, which is aesthetically doubtful)
I would stay with WRITE-TO-XML writing to a stream that defaults to *STANDARD-OUTPUT*. If you like, add a trivial wrapper WRITE-TO-XML-STRING that returns an XML string instead. Writing to a string consumes more memory and it would be stupid to first serialize into a string when one really wants to write to a stream.
- As it is one can't use lists (including cons) as slot values. I've
found this by having a "location" slot in my "army" class which is represented by a cons like (X . Y). This returns an error (since the test is made with consp, but the cdr isn't a list). For cons the "fix" is easy (e.g. use alexandria's proper-list-p), but when a slot value is really a list the output isn't as expected: a class which has '(1 2 3) has a slot value will produce:
<element>1</element> <element>2</element> <element>3</element>
instead of what would be expected:
<element>'(1 2 3)</element>
I do not think that a quoted list in Lisp syntax is expected in XML output. I rather think that the current behavior that you describe is correct, and the XML deserializer should combine the individual elements that occur multiple times into one list. The XML produced should, by default, try to serialize everything into proper XML and not use Lisp data formats.
Cheers, Hans