;;-*- Mode: Lisp; Package: XML -*- ;********************************************************************* ;* * ;* X M L i s p * ;* * ;********************************************************************* ;* Author : Alexander Repenning, alexander@agentsheets.com * ;* http://www.agentsheets.com * ;* Copyright : (c) 1996-2008, AgentSheets Inc. * ;* Filename : XMLisp.lisp * ;* Last Update : 12/16/08 * ;* Version : * ;* 1.0 : 09/19/04 * ;* 1.1 : 09/30/04 encode/decode strings in XML * ;* 1.1.1 : 10/01/04 subobjects can be aggregated as arrays * ;* 1.2 : 10/09/04 abreviated printing to inspector/listener * ;* serialization includes arrays * ;* headers * ;* :type slot interpretation * ;* 1.3 : 10/11/04 content only tags, e.g., bla * ;* 1.4 : 10/12/04 SGML tags: <--, * ;* 2.3.1 : 07/11/05 deal with double AND single quote values * ;* 2.3.2 : 07/14/05 concatenate all content * ;* 2.3.3 : 07/15/05 *Warn-if-undefined-XML-Decoder-Type, * ;* 2.3.4 : 07/20/05 export xml-tag-name-symbol * ;* 2.3.5 : 08/01/05 show-error-in-stream-to-user in * ;* set-attribute-value * ;* encode single quote ' * ;* 2.3.6 : 08/16/05 slot-definition-type most-specific-class * ;* 2.3.7 : 08/30/05 export decode-xml-string encode-xml-string* ;* 2.3.8 : 09/14/05 check boundp *Xml-Stream* * ;* 2.3.9 : 09/16/05 list type decoder * ;* 2.4 : 10/17/05 print-default-value-attributes-p * ;* 2.4.1 : 11/02/05 read-return-value * ;* 2.4.2 : 11/04/05 double-float CODEC * ;* 2.4.3 : 11/09/05 short-float CODE don't print "d" * ;* 2.4.4 : 11/10/05 do not print lisp escape chars in strings * ;* 2.4.5 : 12/02/05 AI: convert relative unix path to lisppath* ;* 2.5 : 01/18/06 print non-t slot types attributes * ;* 2.5.1 : 01/23/06 attribute-name->slot-name, * ;* slot-name->attribute-name * ;* 2.5.2 : 02/10/06 do not print ..D0 double floats * ;* 2.5.3 : 02/17/06 file (setf file). Set by load-object * ;* 2.5.4 : 02/23/06 print pathname to stream * ;* 2.5.5 : 04/05/06 without-xml-reader macro * ;* 2.5.6 : 06/20/06 print-slot-name-value-type-as-attribute * ;* 2.6 : 08/25/06 path type and CODECs * ;* 2.7 : 01/17/07 float array CODEC * ;* 3.0 : 02/10/07 Optimized tree shacked: single file * ;* 3.0.1 : 08/14/07 do not print array content into listener * ;* 3.0.2 : 09/26/07 AI: fallback-class-name-for-element-name * ;* 3.0.3 : 10/30/07 parse-file-name fixed Eirik Mikkelsen * ;* 3.0.4 : 01/29/08 AI: single-float codec * ;* 3.0.5 : 09/23/08 reader skip "<)" * ;* 3.1 : 10/09/08 enhanced reader to deal with * ;* not including space after element name * ;* 3.2 : 11/14/08 if slot if missing lookup acccessor * ;* 3.2.1 : 11/28/08 handle type specifier lists, e.g., boolean* ;* 3.5 : 12/03/08 early instantiation model (see below) * ;* 3.5.1 : 12/10/08 string-upcase symbol codec, float codec * ;* 3.5.2 : 12/16/08 read-return-value fixed, keyword CODEC * ;* Systems : G4, OS X 10.5.5 * ;* Lisps : MCL 5.0, MCL 5.2, LispWorks 4.3.7, CCL 1.2 * ;* CLISP 2.33.83, CMUCL, AGL * ;* Licence : LGPL * ;* Based on : XML by Andri Ioannidou * ;* Abstract : Integrate XML reading/writing with Lisp * ;* To use XMLisp mix in xml-serializer class into your class. * ;* When lisp reader sees: it will * ;* - create an instance of class "BLA" * ;* - set slot "X" to 13 and slot "Y" to 20 * ;* - if slot includes :type use CODEC * ;* Objects can have subobjects. Aggregation can be controlled * ;* by redefining aggregator functions, e.g., add-subobject * ;* * ;* Initialization: * ;* this kind of element: * ;* * ;*