[e-lang] XML support in E
Mark Miller
erights at gmail.com
Sat Jan 16 17:07:03 PST 2010
On Fri, Jan 15, 2010 at 4:47 AM, Kevin Reid <kpreid at mac.com> wrote:
> On Jan 15, 2010, at 6:12, Thomas Leonard wrote:
> > OK, I can create JSON documents easily enough using
> >
> > def Term := <type:org.quasiliteral.term.Term>
> > def serialised := (testData :Term).asText()
> >
> > This is nice and fast, and I assume it could produce XML in a
> > similar way.
>
> Huh, I didn't know that worked except for leaf types. (I find that the
> relevant code is in
> org.erights.e.meta.org.quasiliteral.astro.AstroGuardSugar.)
>
>
Yes. The first test case at src/jsrc/org/quasiliteral/term/Term.updoc is
? [3=>4, "a"=>'x', [2,3]=>[4,5]]:Term
# value: term`{3: 4,
# "a": 'x',
# [2, 3]:
# [4, 5]}`
which exercises some of the interesting cases.
> > I can turn the serialised string back into a term like this:
> >
> > def TermParserMaker := <import:org.quasiliteral.term.makeTermParser>
> > TermParserMaker(serialised)
> >
> > But how do I turn that term back into the E data-structure (i.e.
> > reverse the effect of :Term)?
>
> I don't know of a facility to do this. (deJSONKit does so the long way
> around.) MarkM?
>
> For leaf data terms, their __conformTo already knows how to auto-coerce to
their primitive data value.
Kevin, regarding non-leaf terms, I recall you once wrote such a guard as an
experiment, but I don't think we ever added it to the E library. As I
recall, at the time you may have called it Termish. But that conflicts with
a different use of that name in the org.quasiliteral.term package. I may be
misremembering.
> --
> Kevin Reid <http://switchb.org/kpreid/>
>
>
>
>
> _______________________________________________
> e-lang mailing list
> e-lang at mail.eros-os.org
> http://www.eros-os.org/mailman/listinfo/e-lang
>
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.eros-os.org/pipermail/e-lang/attachments/20100116/3216ac6d/attachment.html
More information about the e-lang
mailing list