Yliopiston etusivulle In English
Helsingin yliopisto
clt236: XML - lukuvuosi 2009-2010

Yhteystiedot

Yleisen kielitieteen laitos

PL 24 (Unioninkatu 40)
00014 HELSINGIN YLIOPISTO

Puhelin +358 (09) 1911 (vaihde)
Faksi +358 (09) 191 28313

9. Apache Ant.

  • Lecture notes
  • Further reading
  • Practical work: Installing AntFarm plugin
    • On Windows, we'll use jEdit to edit Ant buildfiles and we'll use jEdit's AntFarm plugin to run Ant targets. The plugin runs the Apache Software Foundation's open source Apache Ant inside jEdit.
    • To install the AntFarm plugin: Start jEdit and open Plugins -> Plugin Manager -> Install tab. In the Install tab, tick AntFarm and Console, then click the Install button to install them. Using jEdit's menus, open AntFarm and dock it at the left. Open Console and dock it at the bottom.
    • Hello World example: Copy the file build.xml from Hello World in Ant to your Windows folder, keeping the name build.xml. In jEdit's AntFarm panel, add this file to the (empty) list of buildfiles. Click on it to expand the list of targets, and click on the "hello" target to run it. See the output in the Console panel.
  • Practical work: XML validation in Ant
    • Make a subfolder called "in" in your Windows folder. From Apache Ant/XMLvalidate, copy the Ant buildfile to your Windows folder, and copy the XML Schema and the XML data files to the "in" subfolder. In jEdit's AntFarm panel, add the buildfile to the list of buildfiles. Click on it to expand the list of targets, and click on the "ValidateXML" target to run it.
    • Copy memory.xsd and memory2.xml into the "in" subfolder. Validate the file against the Schema by running the "ValidateXML" target again in Ant.
      Edit memory2.xml with jEdit to make deliberate mistake 1 (by changing the first <memory> to <memoir>) and validate it again in Ant.
      Edit it further to make deliberate mistake 2 (by also changing the first </memory> to </memoir>) and validate it again in Ant.
  • Practical work: XSLT transformation in Ant
    • Make more subfolders "out", "xslt" and "lib" in your Windows folder.
      Copy sonnet130.xml and sonnet.dtd into "in".
      Copy sonnet-html.xsl into "xslt".
      Copy the jar files from this Ant/lib directory into your "lib".
    • Copy the Apache Ant buildfile clt236-ant-build.xml to your Windows folder.
      In jEdit's AntFarm panel, add this file to the list of buildfiles, and click on it to expand the list of targets. Click on the "SonnetXSLT" target to run the XSLT transformation.
  • Practical work on Linux
© 2001-2009 Graham Wilcock