guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xmlish


From: Stefan Israelsson Tampe
Subject: Re: xmlish
Date: Mon, 15 Jul 2013 18:23:48 +0200

Yeah the grunt work is in the plain ol sxml codebase. I just modded slightly the compiler
(it's extensible) see simple.scm to be able to get a more sane output of namespace information
so xmlish is just a slightly modified version of sxml to be able to handle some namespace issues.
The rest is just a thin layer. The hard work would be in a schema validator and translator framework
for which I have not found any tool yet.

Cheers
Stefan


On Mon, Jul 15, 2013 at 5:27 PM, Chaos Eternal <address@hidden> wrote:
http://en.wikipedia.org/wiki/SXML

On Mon, Jul 15, 2013 at 11:12 PM, Stefan Israelsson Tampe
<address@hidden> 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?
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]