Adventures in XML
As most reader of my blog will know, while I have always defended the use of XML, it is has been a case of intellectual honesty rather than preference. I don't like angle brackets. They make my eyes bleed :->
So, why am I going to use XML as a concrete syntax for my DSLs? Firstly because it means I'll be able to reuse config files between different programming languages. As well as ColdFusion, I should have at least a Ruby and possibly a Java implementation of my framework by early next year and I want to make sure that most applications can be ported between languages without having to change any code.
Secondly, I'm really just using it as an interface to lower the coupling between my feature modeler and my framework. I'll still be keeping all of the statements in a database to make it easier to select and configure features from a database of pre-build statements in the various DSLs. The XML just makes a convenient output format for the feature modeler, so while there will be XML, at least human beings won't actually have to write it by hand (ugghh - what a thought :->).
And finally, all the usual stuff about free parsing, the ability to validate against a schema and so forth. If I had more time and human beings were really going to have to create these files, I'd bite the bullet and write a parser in ANTLR using my own custom syntax (from what Mark says, ANTLR 3 rocks!). If I didn't need to support multiple 3GLs, I'd stick with my in language APIs, but for this use case, XML fits just right. Of course, it is still being consumed by config beans which then do a lot of automagic to make sure a little configuration goes a long way. For example, you don't have to describe how to wire your beans together. You just describe the object model and the config bean is smart enough to know that your service methods and business objects need to have a DAO mixin injected and so on.
Thoughts?


Is YAML not supported enough to consider using? Not that I'm that anti-XML ... just wondering really. As you said, no body really needs to look at these things, so who cares what it looks like? Compile it SFBC - Systems Forge Byte Code for all anyone cares, right? =)
Of course, that whole semantic whitespace issue crops up in using DSLs in YAML.
http://www.yaml.org/start.html
However as you mentioned, the meaningful whitespace (while nice) is a bit of a pain for generation, and then I'd have to find some kind of YAML -> XML tooling to take advantage of any XML specific features like XPath, etc.
I'll probably play with this some time, but only when my eyes start bleeding form the angle brackets :->
A wise man once said, "XML is like lye. It is very useful, but humans shouldn't touch it." If you've had to incorporate XML into your project by hand, you have probably been burned by getting too close. NetKernel turns this wisdom on its head and encourages you to use XML like the liquid data stream you want it to be. Imagine the simplicity of REST married to the power of Unix pipes. Come see how this open source / commercial product built on a compelling modern architecture can be used to create, manipulate and transform XML.
Might be worth checking into (not necessarily for this, but in general).