[fetter-devel] Fwd: flexml: a new document model i'm playing with

Attila Lendvai attila.lendvai at gmail.com
Fri Nov 23 15:18:17 UTC 2007


(i've sent this to cxml-devel, but it opens a door to a possible
refactor of verrazano using method dispatch instead of fighting with
sxml)

hi!

i've playing with an document builder that may be interesting for the
list. the basic idea is to parse the xml into CLOS objects with their
own class, so that method dispatch can be used to process the
document. i need this for verrazano, to process the gccxml output. the
first part of the file contains the generic flexml document builder
and at the end there's some specialized code for gccxml.

how it works: you can give it a default lisp package and also register
namespace-uri->lisp-package mappings. when a node is encountered then
a symbol is looked up in the appropriate package and make-instance is
used to make the node. there's also a slot-missing specialization on
it, so that it can store random slots (attributes) in a hashtable.

features currently:
 - can resolve crossreferences, see cross-referenced-node slot type and friends
 - handles some slot types specially: cross-referenced-node,
cross-referenced-nodes, integer, boolean, etc
 - can store attributes in a mixed slot/hashtable mode where simple
attributes can go into the hashtable and special ones can be
full-featured slots

the code for now is only a proof of concept, but i wonder if there
would be a place for it somewhere in a repo around cxml? it won't be
bigger then a few pages so i think the most practical distribution
would be to have its own .asd/package in the cxml repo/directory. but
i don't want to run ahead... it even could be that i'm doing duplicate
work with this.

opinions?

--
 attila
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xml-parsing.lisp
Type: application/octet-stream
Size: 10477 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/fetter-devel/attachments/20071123/1a5a9699/attachment.obj>


More information about the fetter-devel mailing list