The net-xml-generator module, a new XML generator, uses the Common Lisp pretty printer and a modified readtable to generate pretty-printed XML with intuitive indentation and line breaks. In many dialects of XML white space is not significant, but when developing applications that emit long XML documents, human readability is essential. Everyone has suffered the pain of trying to read the source for a web page in a browser where all the (x)html is on a single unreadable looooooong line. Once an application is debugged, of course, the pretty printer can be turned off to reduce the size of the generated output.
A reader macro marks intended XML elements lexicographically in Lisp source code. Note that Lisp source code and XML are both tree languages. Using this module, the logical structure of the application code that generates XML maps simply and transparently onto the intended XML. The entire vocabulary of Lisp forms (iteration, conditionals, case, and function calls) can be employed and freely mixed with the XML generation. This is a significant difference from the unrelated htmlgen module distribited with AllegroServe.
See the file xml-generator-blurb.html (included in the distribution and a copy linked to here) for a gentle introduction, and xml-generator-blurb.cl which shows how that html file was itself generated using the module.
The module is open source and is available from http://github.com/franzinc/net-xml-generator. It works with all currently supported Allegro Common Lisp versions. It mostly should work on other implementations, but uses the ACL named-readtable facility (the lack of which can be worked around easily) and more importantly may depend on subtle details of the pretty printer.
Full documentation is included in the source file net-xml-generator.cl. As said above, the file xml-generator-blurb.cl is a self-referential example of Lisp code which produces the page xml-generator-blurb.html.
If you have any questions about the module or suggestions, please email us at firstname.lastname@example.org.
|Copyright © 2013 Franz Inc., All Rights Reserved | Privacy Statement||