Re: XML should NOT be a new programming language
[Patrick Ohl] > 3.3 source code generators > > So what to do? The next concept should suite Niels Peter. If we can > restrict the (java) application to use one single grammar and we have a > relatively stable version of the grammar at development time we can use > source code generators. These generators parse a specified grammar and > construct a set of classes (or constructs of a programming language). > Instances of these classes are then a representation of a (valid) xml > document following the specified grammar. With the help of certain > utility classes we can serialize a object structure to or deserialize > from a xml document. We have nearly no contact with xml and can work on > and modify the generated classes. > Patrick, I don't mean to dismiss the rest of your post, which I found interesting, but I just want to talk about code generators a little. Recently I found myself using xslt to generate python code to automate a repetitive job. I had to iterate over a collection of xml files, according to some process data in another xml file, and do some processing. It would have been easy to do it by hand or by means of a script for any one instance, but very tedious to do a lot of iterations. I wrote an xslt stylesheet that took a list of the file names in one xml file (which I created using a batch file) and the xml process data file, and created a python script. The python script iterated through all the files, producing the output for each one. It was easy to modify the styleshseet, once I had the first one, to handle each of the five similar cases I needed to run. In a way, this amounts to using an xslt transform as if it were a shell script, whose output was piped to other programs. The program generator/shell script approach was easy and effective. Cheers, Tom P
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format