[REBOL] Re: XML / dialects
From: pwoodward:cncdsl at: 8-Jan-2002 10:25
Brett -
It's definitely clear that XML is of some interest to the REBOL community.
Most of my work with XML has been done with Java, using the Xerces parser -
SAX basically. Although I've also done some work with it under ASP - it's
quite conveinient to retrieve recordsets as XML from a database, and use an
XSL to transform it for display...
> Actually VID is an interesting example. What would it look like as XML?
How
> would we write a program to interpret an XML-VID and build a GUI directly?
> Maybe someone should encode a VID layout as an XML document (not to forget
> building a DTD or whatever). Then we convince some ambitious soul to make
a
> program to interpret such a document via an XML parser, and build a
working
> GUI directly. Then we can sit back and say "Ah good job dude. You've used
> state of the art technology and current thinking to produce that display.
> But couldn't you do it in one line rather than pages of code?". But that
> would be too cruel.. :)
That would be pretty cool - as in theory one could use an XSL to transform
the XML representation of a View layout to another format. Oldes has been
doing a lot of work creating a Flash dialect so that Flash files can be
generated using REBOL. One possibility might be exporting a layout to XML,
so that it could be readily transformed into other dialects via XSL?
That way (depending on the complexity of the interface) a View layout could
be exported and transformed into Flash, HTML, or some other interface
representation...
Reading XML in would ideally be handled in a very OO way. Unfortunately (or
fortunately) this seems to be the best way to manage things... You would
end up with an object that represents your XML within REBOL. Elements could
be accessed using the standard REBOL path nomenclature, along with the
attributes of those elements. Another thing that would be useful would be
extraction of XML fragments via path access, copying them into a new XML
object... It would need some sort of mechanisms to iterate across the
elements of the document too.
For example:
<person gender="male">
<firstname>Porter</firstname>
<lastname>Woodward</lastname>
</person>
person: to-xml-object read %person.xml
print person/firstname ==> Porter
print person/gender ==> male
At least these are just some of my thoughts on how this might be done.
- Porter