http://en.wikipedia.org/wiki/SXML
On Mon, Jul 15, 2013 at 11:12 PM, Stefan Israelsson Tampe
<stefan.itampe@gmail.com> wrote:
> Hi all,
>
> 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
> * xml-schemish
>
> 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.
>
> Example 1
> file1:
> (define-module (a.b.com x))
> (define-xmlish-names ab (a b)))) ;; ab is the recomended prefix
>
> file2:
> (define-module (a.b.com y))
> (define-xmlish-names cd (c d))))
>
> Authoring
> (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
> (xmlish->xml message)
> =>
> ...
> <ab:a q="1">
> <cd:c>
> <ab:b/>
> <cd:d/>
> </cd:c>
> </ab:a>
>
> 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
>
> By e.g.
>
> (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
> longer to
> 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.
>
> WDYT?
>
>
>