From: Ken A. <kan...@bb...> - 2004-10-05 21:26:43
|
Mike Thome came up with a way of generating indented HTML. The basic idea is rather than going form s-expressions to XML directly, you go from s-expression -> XML equivalent s-expression and then write a xml pretty printer that outputs the equvalent xml text from the s-expression. Our s-expression XML notatation represents XML as `(,tag . ,body) Where tag is either a symbol or `(,symbol . ,attributes) where attributes is a list of either a symbol or `(,attribute ,value). And body is a sequence of XML. The changes to the code i sent out the other day are simply: (define (xtag tag) (lambda (as . bs) (let ((as (if (pair? (car as)) as (list as)))) (if (pair? as) (cons (cons tag as) bs) (cons tag bs))))) (define (xatt name) (lambda (x) (list name x))) So there are 2 more ways to generate XML. W1: Use Geoffrey's technique as before. OK, this isn't new, just a mod. (owl:DatatypeProperty (rdf:ID name) (rdfs:comment (rdf:datatype "&xsd:#string") documentation) (rdfs:domain (rdf:resource class)) (rdfs:range (rdf:resource "&xsd;#string"))) W2: Use quasiquote to construct the xml s-expression: `((owl:DatatypeProperty (rdf:ID ,name)) ((rdfs:comment (rdf:datatype "&xsd:#string")) ,documentation) ((rdfs:domain (rdf:resource ,class))) ((rdfs:range (rdf:resource "&xsd;#string")))) |