unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* xmlish
@ 2013-07-15 15:12 Stefan Israelsson Tampe
  2013-07-15 15:27 ` xmlish Chaos Eternal
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Israelsson Tampe @ 2013-07-15 15:12 UTC (permalink / raw)
  To: guile-user

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?





^ permalink raw reply	[flat|nested] 4+ messages in thread
* xmlish
@ 2013-07-16 16:03 Stefan Israelsson Tampe
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Israelsson Tampe @ 2013-07-16 16:03 UTC (permalink / raw)
  To: guile-devel, guile-user

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

Heya Heya guile and all the guilers!

I just pushed a simple tool to handle name spaced xml using the guile
module system
It is in an initial state and is a small shell around sxml. I will use it
as a base for handling
xml-schema specifications. Anyway if interested checkout

   https://gitorious.org/guile-xmlish

Have fun!

/Stefan

[-- Attachment #2: Type: text/html, Size: 601 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-16 16:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-15 15:12 xmlish Stefan Israelsson Tampe
2013-07-15 15:27 ` xmlish Chaos Eternal
2013-07-15 16:23   ` xmlish Stefan Israelsson Tampe
  -- strict thread matches above, loose matches on Subject: below --
2013-07-16 16:03 xmlish Stefan Israelsson Tampe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).