Hi Bill,
Sorry if my question sounded odd.
I know the advantages of XML too. I'm also aware that the XML police will not come and get me
(lucky me)
But my doubt was regarding using XML for scripting tools like ANT.
I feel writing scripts in XML is a non intuitive approach. Because, XML is best suited for representing data, for all the advantages that you already quoted. But for scripting, something like a programming language will be more suited and intuitive.
If you have used ANT, you would understand the point I'm trying to make here.
Take a simple ant build script for example:
<target name="-compile" description="Compiles code">
<echo>Checking if required jar is present in the directory abc</echo>
<available file="xyz.jar" property="xyz.available"/>
<fail unless="xyz.available" message="Unable to find xyz.jar..Exiting Build..."/>
<echo>Found xyz.jar in the directory abc</echo>
<mkdir dir="build"/>
<mkdir dir="classes"/>
<mkdir dir="temp"/>
<copy todir="temp" file="file_list.txt"/>
<javac srcdir="src" includesfile="temp/file_list.txt" destdir="classes" debug="yes">
<classpath refid="classpath"/>
</javac>
<delete dir="temp"/>
</target>
What is happening above is a series of logical steps being carried out one after the other. These logical steps are presented as XML tags. Here's where I was wondering. Does it make sense to represent a logical flow as XML tags; and for what advantage? Isn't it the work of a programming language to do tasks similar to above. Something like Perl, Unix shell scripts, DOS batch files, or plain
java?
In a simple sudocode, the above build script would be something roughly equal to the below:
sysout(�checking if requird file is present...�);
if (�xyz.jar� exists)
{
sysout(�File found�);
mkdir �build�;
mkdir �classes�;
mkdir �temp�;
copy to temp �file_list.txt�;
javac srcdir=�src� includesfile="temp/file_list.txt" destdir="classes" debug="yes";
delete dir temp;
}
else
{
echo �File not found�;
}
I'm not telling that ant is not a good tool. In fact, I do like the tool much and am very much dependent on the tool myself.
But do you think this is proper usage of XML?
[ July 28, 2008: Message edited by: Sandeep Narasimhamurthy ]