I have become ever more attracted to JsonML <<a href="http://jsonml.org/">http://jsonml.org/</a>> as a way to handle XML data. Since E's term trees already handle JSON, I suggest using the JsonML mapping of XML data into JSON structures. I suggest we would then have no need for an XML quasi-parser. We could just use the term tree quasiparser in quasi-JsonML format, to manipulate XML trees as translated to JsonML structures. Even for text markup, which is the best case for the XML vs JsonML comparison, I still find JsonML notation more readable than XML.<br>
<br><br><br><div class="gmail_quote">On Tue, Jan 12, 2010 at 2:06 PM, Kevin Reid <span dir="ltr"><<a href="mailto:kpreid@mac.com">kpreid@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Oct 26, 2009, at 13:08, Thomas Leonard wrote:<br>
<br>
> Could someone give some simple examples showing how to read and write<br>
> XML using E?<br>
><br>
> The XMLQuasiParser looks reasonable, but says it is deprecated in<br>
> favour<br>
> of using Terms. I can build Terms manually, but I can't see how to<br>
> turn<br>
> serialised XML into a Term, or a Term into serialised XML.<br>
><br>
> I found this, but it doesn't say which methods to call:<br>
><br>
> <a href="http://www.erights.org/data/terml/embeddings.html" target="_blank">http://www.erights.org/data/terml/embeddings.html</a><br>
><br>
> There's also Term.updoc in the source, which shows how to convert a<br>
> sml<br>
> DOM to a term, but not the other way around. Also, sml doesn't support<br>
> all of XML, e.g.<br>
><br>
> ? sml`<foo/>`<br>
> # problem: Failed: syntax error: expected '>' but got '/' at 4<br>
<br>
</div>There is no E-styled XML library built into E; this is certainly<br>
something which ought to be addressed.<br>
<br>
Such a library should of course use immutable trees (vs. e.g. DOM<br>
which is mutable) and have quasiliteral/pattern support for users.<br>
<br>
<br>
E-on-JavaScript's Updoc-to-HTML component is an example of XML<br>
manipulation in E: it uses the Java DOM libraries (and, when a real E<br>
XML library exists, should be converted to use it).<br>
<a href="http://wiki.erights.org/wiki/E-on-JavaScript" target="_blank">http://wiki.erights.org/wiki/E-on-JavaScript</a><br>
<br>
<br>
There are two different approaches which could be used for an E XML<br>
library: one is to use the Term-tree objects, and merely write an<br>
xml__quasiParser which allows one to use the XML-in-TermL embedding,<br>
as well as facilities for reading/writing XML documents. The other is<br>
to have a distinct object type for XML tree nodes; this has the<br>
advantage that its methods can be optimized for the needs of XML<br>
applications, and its __printOn would show XML rather than TermL.<br>
<br>
Parsing and printing could be handled for starters by using Java's<br>
builtin XML facilities; I'm not sure exactly how much could be reused<br>
vs. reimplented.<br>
<br>
Questions:<br>
<br>
* Would you be interested in working on the project of an XML library<br>
for E?<br>
<br>
* If I were to work on it, would you use it and give feedback?<br>
<font color="#888888"><br>
--<br>
Kevin Reid <<a href="http://switchb.org/kpreid/" target="_blank">http://switchb.org/kpreid/</a>><br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
<br>
_______________________________________________<br>
e-lang mailing list<br>
<a href="mailto:e-lang@mail.eros-os.org">e-lang@mail.eros-os.org</a><br>
<a href="http://www.eros-os.org/mailman/listinfo/e-lang" target="_blank">http://www.eros-os.org/mailman/listinfo/e-lang</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Text by me above is hereby placed in the public domain<br><br> Cheers,<br> --MarkM<br><br>