<?xml version="1.0" encoding="iso-8859-2"?>

<project name="02_dom" default="about">

  <description>
      XML/SGML - lab_02 - DOM
      
      Wywolanie:
        ant run [-Dinput=file.xml]
  </description>

  <!-- ustawienia globalne dla projektu -->

  <property name="jars.path" value="/home/mismap/p/pc176468/jar"/>
  
  <path id="project.classpath">
     <pathelement location="${jars.path}/xml-apis.jar"/>
     <pathelement location="${jars.path}/xalan.jar"/>
     <pathelement location="${jars.path}/xercesImpl.jar"/>
     <pathelement location="${jars.path}/xalansamples.jar"/>
     <pathelement location="."/>
  </path>

  <!-- cele główne -->

  <target name="about">
    <echo>Uruchom 'ant -projecthelp'</echo>
  </target>

  <target name="compile" description="Kompiluj wszystkie pliki">
    <javac srcdir="." destdir="." classpathref="project.classpath" encoding="8859_2"/>
  </target>

  <target name="clean" description="Kasuj skompilowane klasy">
    <delete dir="pl"/>
  </target>

  <target name="run" depends="compile,prepare-input,prepare-output" description="Uruchom aplikacje testowa">
    <java classname="pl.edu.mimuw.xmllab.SimpleDOM" fork="yes">
      <classpath refid="project.classpath"/>
      <arg value="${input}"/>
      <arg value="${output}"/>
    </java>
  </target>

  <!-- cele pomocnicze -->

  <target name="prepare-input" unless="input">
    <!-- jezeli input nie podany to example.xml -->
    <path id="basedir-path" path="${basedir}"/>
    <pathconvert dirsep="/" property="newbasedir" refid="basedir-path"/>
    <property name="input" value="file:///${newbasedir}/example.xml"/>
  </target>

  <target name="prepare-output" unless="output">
    <!-- jeżeli output nie podany to nie przekazywany do programu -->
    <property name="output" value=""/>
  </target>

</project>
