[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML should NOT be a new programming language

shell script iterate over files
[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.


Tom P


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.