[REBOL] XML comments >> implications for R3
From: jasonic::nomadics::org at: 9-Sep-2007 11:27
Carl's points about XML are all quite valid and pertinent- but the story
does not end there, and he left some important things out...
a ~ Like it or not XML is widely used as a structuring markup for
transport between systems, languages etc. It's the interoperability that
counts.
REBOL is glorious but thus far little known or used in the world. The
smartest most elegant best solution is not the only criteria we need to
consider. Sorry {truly}
b ~ It may be boring and verbose, but it is also easy to understand,
especially for machines and scripts written by humans for programs and
machines.
Cool uses of XML in the world ? RSS syndication, XMLRPC and Jabber [XMPP]...
en.wikipedia.org/wiki/*RSS*_(file_format)
en.wikipedia.org/wiki/XML-RPC
www.jabber.org/
en.*wikipedia*.org/wiki/Extensible_Messaging_and_Presence_Protocol
c ~ There are numerous libraries now for passing using XML more easily
and more efficiently.
And there are some superb XML editors which quite transform the job --
OXYGEN, XMLSpy, Stylus Studio for example:
www.*oxygenxml*.com
www.Altova.com/*XML*Spy
www.stylusstudio.com/*XML-Tools*
To really enjoy the benefits one must try out the the advanced pro
versions of these [not free but can download demos].
Awesome in these are the schema and XSLT handling functions. For example
open an XML file and immediately parse and generate a valid Schema.
Save. Now go write a new XML file using that schema -- et voila --
really nice in-line prompts make this a joy.
Now switch to another view like a grid or hide the <tag> structured part
of the code.. ahha yes yes this makes sense and takes the pain away to
reveal the gains.
d ~ Trends are clearly towards much more powerful friendly intelligent
ways to handle it - XML object serialization, JSON, E4X.
http://www.json.org/
For example E4X is the new ECMAscript [Javascript] extension which at
last provides a sane and sensible alternative..
* |<order id="1234">
<customer><name>Joe Green</name>
<address><street>410 Main</street>
<city>York</city><state>VT</state>
</address>
</customer>
<item>. . .</item>
<item>
<make>Acme</make>
<model>Framistat</model>
<price>2.50</price>
<qty>30</qty>
</item>
</order>|
* |var address = order.customer.address;|
* |var second = order.item[1];|
* |second.total = second.qty * second.price;|
*
* |var order = <order><customer>. . .</customer>
<item><price>5</price><qty>10</qty></item>
<item level="rush">
<price>2.5</price>
<qty>30</qty>
</item>
<item level="rush">
<price>1.5</price>
<qty>50</qty>
</item>
</order>;|
* |var items = order.item; // XMLList of item el'ts |
* |var prices = order..price;|
* |var urgentItems = order.item.(-level == "rush");|
* |var itemAttrs = order.item[0].-*;|
yes linear dotted notation parses the structure by NAMEs
- symbol accesses XML attributes cleanly [hooray]
.. double dots get multiples
[] access array items by index
* wildcards do what you need them to
inclusion of variables etc etc
use E4X to read and write :-)
http://en.wikipedia.org/wiki/E4X
Nice slide show at http://developer.mozilla.org/presentations/xtech2005/e4x/
e ~ AS3 Actionscript 3 now includes E4X . Flash and Flex, AIR
programmers can all benefit. Good news is that Adobe after buying
Macromedia built it into the free cross platform Flash9 runtime player
and then open sourced it :-) So this important gift-back by Adobe is now
called TAMARIN, open source implementation of ECMAscript, a free virtual
machine and just in time compiler
http://www.mozilla.org/projects/tamarin/
http://en.wikipedia.org/wiki/Tamarin_(JIT)
f ~ Those hideous XML tags vs. Attributes
In most examples people provide of how horrible is XML, they show only
nested tags for ever and from hell. This makes a point, but in reality
using XML attributes _appropriately_ instead of tags in the XML source
makes it much easier to understand, and far less verbose.
g ~ XSLT and REBOL
Although it is not very pretty XSLT actually has a *lot* in common with
rebol
h ~ What's next ?
Well I hope that R3 provides a really smooth path for XML input and
output - truly compatible with the new E4X approach
** Finally Adobe 'Tamarin' and open sourcing of Flash/Flex opens up the
game for Rebol graphic options.
I'm thinking it might be a modest investment now which could update
Oldes brilliant Rebol/Flash dialect and integrate it into the R3
official GUI toolbox **
http://oldes.multimedia.cz/swf/
Jason