[developers] SBCL port: XML

Ben Waldron bmw20 at cl.cam.ac.uk
Thu Oct 26 11:22:43 CEST 2006

I've checked in the S-XML XML module alongside the old pxml module. The 
SMAF code now uses this new module under /all/ Common Lisps (because 
it's that much more efficient and generates less garbage); the (R)MRS 
and SPPP code still uses the old pxml module under Allegro Lisp, but 
will use S-XML under any other Lisp. To achieve this I've used a 
compiler macro (:pxml) which is set when we are compiling with pxml (eg. 
under Allegro). When this compiler macro is set, the (R)MRS and SPPP 
code will use the pxml module for XML processing. To access pxml it is 
necessary to use the "net.xml.parser" package (the "xml" package comes 
built-in to S-XML).

Ann, I added the following patch rmrs/xml-utils.lsp:

Index: rmrs/xml-utils.lisp
RCS file: /lingo/CVS/lkb/src/rmrs/xml-utils.lisp,v
retrieving revision 1.9
retrieving revision 1.10
diff -r1.9 -r1.10
 > #+:pxml
<   (let ((raw-xml (xml:parse-xml istream)))
 >   (let ((raw-xml (net.xml.parser:parse-xml istream)))
 > #-:pxml
 > (defun parse-xml-removing-junk (istream)
 >   (lxml::shift-package (xml:parse-xml istream) :mrs))

Stephan, I added the following patch to glue/sppp.lsp:

Index: glue/sppp.lsp
RCS file: /lingo/CVS/lkb/src/glue/sppp.lsp,v
retrieving revision 1.9
retrieving revision 1.10
diff -r1.9 -r1.10
<              (xml:parse-xml (string-trim '(#\newline) 
 >              #+:pxml
 >            (net.xml.parser:parse-xml (string-trim '(#\newline) 
 >            #-:pxml
 >            (list :dummy (lxml::shift-package (xml:parse-xml 
(string-trim '(#\newline) *sppp-input-buffer*)) *package*))
 >            )

The grand outcome of these changes: XML support is now available when 
compiling the LKB under Steel Bank Common Lisp.

- Ben

Ben Waldron wrote:
> Ann Copestake wrote:
>> this sounds good, but I would prefer that you left the pxml code 
>> there as it is and used a compiler macro or whatever to interface to 
>> the S-XML for SBCL for now.  I need XML parsing for a variety of 
>> purposes related to the RMRS code - it doesn't seem you've tested 
>> these and I don't have time to test or rewrite them myself at the 
>> moment.
> ...
> In the meantime I'll check in the S-XML module alongside the pxml module.

More information about the developers mailing list