XML "Programming Language"?
March 7, 2007 9:21 AM
Subscribe
I maintain a program that does something complex based on a simple set of explicit commands. For example, if it were a painting robot (the truth is far more boring), you give it an XML file with elements like (angles swapped for brackets) [rectangle x="40" y="40" w="10" h="10" color="red"/] and it goes and paints it. I have some users that would like to write loops, functions, and keep variables -- but I don't want to write a state machine or interpreter. Is there some sort of language/specification that compiles a simple XML-type language into "flat" XML?
In the painting case I could let users submit a file like: [loop x=0 to x=10 step=1] [rectangle x="$x" y=10 w=10 h=10/][/loop] and some library or separate program would take that file and render a flat XML file like [rectangle x=0 .../][rectangle x=1 .../] ... [rectangle x=10 .../]. I would rather not change my program to accept anything but flat XML, but I could add a parser to it that handled all this stuff for me and spit out just the commands to my program, one after another. Sort of like a compiler that output xml elements instead of machine code.
I've looked at RELAX and XSLT, and neither seem to do what I want-- I think.
posted by neustile to computers & internet (6 comments total)
1 user marked this as a favorite
A few years ago I was forced to use Maven, the evil abomination, and the only good thing about it was the Jelly scripting language. Not sure if it's exactly what you're looking for, though.
posted by veedubya at 9:54 AM on March 7, 2007