[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Stefan Israelsson Tampe
Mon, 15 Jul 2013 17:12:27 +0200
KMail/4.9.5 (Linux/3.5.0-30-generic; KDE/4.9.5; x86_64; ; )
At work we needed to handle xml schema documents with java and
C#. There are pretty good support there, but as a schemer I was
wondering if we could support this as well.
My take on this is to design two layers of logic ontop of guile sxml
xmlish will mainly allow for a fairly simple abstraction to direct the
translation of xml to xmlish and vice versa. Also the module system in
guile would be used to handle the xml namespaces seamlessly. In doing
that the typical authoring of the xmlish version of sxml would be to
use the syntax system and hence one would write unquoted sexp.
(define-module (a.b.com x))
(define-xmlish-names ab (a b)))) ;; ab is the recomended prefix
(define-module (a.b.com y))
(define-xmlish-names cd (c d))))
(use-modules (a.b.com x))'
(use-modules (a.b.com y))
(define message (a (@ 'q "1")
(c (b) (d))))
Then the output would be something like
The drawback is that all tags need to be in a namespace, but else
everything should be really simple.
There is a possibility to define translator functions
f1,f2 : (lambda (x map) ...)
x would be the value under translation and map is the namespace map
used to translate name prefixes to actual namespaced quantities e.g.
allow namespaced attribute values which is used in e.g. xml schema.
To translate attribute values
(define-xmlish-names ab ((a ('q f1 f2)) b)) with
f1 := (lambda (x map) (string->number x))
f2 := (lambda (x map) x)
this shows the simple layer to handle xml data and namespaces
in a guilish and schemish way.
So this is basically the simple story. The next level is to support
xml schema for xml specification, xml-schemeish. That will take much
accomplish but in the end I want to be able to bring validator and
sane xml->xmlish, and xmlish->scheme translators and the possibility
to define a module out of refering to a xsd file.
Stefan Israelsson Tampe <=
- xmlish, Stefan Israelsson Tampe, 2013/07/16