<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (c) 1995-2011 held by the author(s).  All rights reserved.
                          
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer
      in the documentation and/or other materials provided with the
      distribution.
    * Neither the names of the Naval Postgraduate School (NPS)
      Modeling Virtual Environments and Simulation (MOVES) Institute
      (http://www.nps.edu and http://www.MovesInstitute.org)
      nor the names of its contributors may be used to endorse or
      promote products derived from this software without specific
      prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-->

<!--
    Document   : build.xml
    Created on : 25 April 2006
    Author     : Don Brutzman
    Description: Creation and customization of Ant build.xml files for each X3D examples archive using common template
    Version    : $Id: build.xml 10381 2012-02-11 21:23:12Z brutzman $
-->

<project name="X3D examples: archive top level" default="all" basedir=".">
    <description>Creation and customization of Ant build.xml files for each X3D examples archive using a common template.</description>

    <!-- private configuration properties:  server names, user names and passwords ====================== -->

    <property name="access.properties.filename"  value="/.access/access.properties"/>
    <property file="${access.properties.filename}"/>

    <!-- ======================================================================================== -->

    <property environment="env"/>

    <!-- note that Netbeans default path is built in and will have to be overridden by going to   -->
    <!-- Tools > Options > Miscellaneous > Ant                                                    -->
    <!-- and then pointing to C:\apache-ant-1.8.2 (or somesuch directory)                         -->

    <!-- ANT Contrib archive at http://sourceforge.net/project/showfiles.php?group_id=36177       -->
    <!-- must have ant-contrib.jar in ANT_HOME/lib (or else specify path)                         -->
    <taskdef resource="net/sf/antcontrib/antlib.xml"/>

    <property name="saxon.dir" location="C:/java/saxonb9-1-0-6j"/>
        
    <!-- Ant Subversion Task at http://sourceforge.net/projects/antsvntask                        -->
    <!-- must have antsvntask.jar in ANT_HOME/lib (or else specify path)                          -->
    <!--
    <taskdef name="subversion"
             classname="net.tralfamadore.ast.tasks.SubversionTask"
             classpath="${ANT_HOME}/antsvntask-0.1.25/antsvntask.jar"/>    -->

    <property name="xj3d.dir" value="C:/Xj3D.nps"/>
    
    <property name="X3dToXhtml"                   location="../../stylesheets/X3dToXhtml"/>
    <property name="X3dToVrml97"                  location="../../stylesheets/X3dToVrml97"/>
    <property name="X3dToX3dvClassicVrmlEncoding" location="../../stylesheets/X3dToX3dvClassicVrmlEncoding"/>

    <xmlcatalog id="X3dCatalog">
        <dtd    publicId="ISO//Web3D//DTD X3D 3.0//EN"                                  location="../../../../specifications/x3d-3.0.dtd"/>
        <dtd    publicId="ISO//Web3D//DTD X3D 3.1//EN"                                  location="../../../../specifications/x3d-3.1.dtd"/>
        <dtd    publicId="ISO//Web3D//DTD X3D 3.2//EN"                                  location="../../../../specifications/x3d-3.2.dtd"/>
        <dtd    publicId="ISO//Web3D//DTD X3D 3.3//EN"                                  location="../../../../specifications/x3d-3.3.dtd"/>
        <dtd    publicId="http://www.web3d.org/specifications/x3d-3.0.dtd"              location="../../../../specifications/x3d-3.0.dtd"/>
        <dtd    publicId="http://www.web3d.org/specifications/x3d-3.1.dtd"              location="../../../../specifications/x3d-3.1.dtd"/>
        <dtd    publicId="http://www.web3d.org/specifications/x3d-3.2.dtd"              location="../../../../specifications/x3d-3.2.dtd"/>
        <dtd    publicId="http://www.web3d.org/specifications/x3d-3.3.dtd"              location="../../../../specifications/x3d-3.3.dtd"/>
        <entity publicId="http://www.web3d.org/specifications/x3d-3.0.xsd"              location="../../../../specifications/x3d-3.0.xsd"/>
        <entity publicId="http://www.web3d.org/specifications/x3d-3.1.xsd"              location="../../../../specifications/x3d-3.1.xsd"/>
        <entity publicId="http://www.web3d.org/specifications/x3d-3.2.xsd"              location="../../../../specifications/x3d-3.2.xsd"/>
        <entity publicId="http://www.web3d.org/specifications/x3d-3.3.xsd"              location="../../../../specifications/x3d-3.2.xsd"/>
        <!-- Transitional DTD, versions 3.1 and 3.1 only -->
        <dtd    publicId="file:///www.web3d.org/TaskGroups/x3d/translation/x3d-3.0.dtd" location="../../../../specifications/x3d-3.0.dtd"/>
        <dtd    publicId="file:///www.web3d.org/TaskGroups/x3d/translation/x3d-3.1.dtd" location="../../../../specifications/x3d-3.1.dtd"/>
    </xmlcatalog>

    <!-- TODO:  warning if Ant version is earlier than apache-ant-1.6.5 -->

    <!-- Ant macro definitions ===================================================================================== -->

    <!-- excerpted/adapted from "SAXON XSLT Processing with Ant" by James Fuller, http://ablog.apress.com/?p=753 -->  
    <macrodef name="Saxon9" description="Invoke XSLT transformation on passed scene using passed stylesheet">
        <attribute name="scene"/>
        <attribute name="stylesheet"/>
        <attribute name="extension"/>
        <attribute name="compiled"/>
        <sequential>
            <!-- <echo message="Saxon9 processing @{scene}.@{extension}"/> -->
            <if>
                <equals arg1="@{compiled}" arg2="true" />
                <then>
                    <java classname="net.sf.saxon.Transform" classpath="${saxon.dir}/saxon9.jar;." fork="true" failonerror="false">
                        <!--<arg value="-t"/> timing information -->
                        <arg value="-warnings:recover"/> <!-- recover after writing a warning message -->
                        <arg value="-c"/>  <!-- compiled stylesheet -->
                        <arg value="-o"/>
                        <arg value="@{scene}.@{extension}"/>
                        <arg value="@{scene}.x3d"/>
                        <arg value="@{stylesheet}"/>
                    </java>
                </then>
                <else>
                    <java classname="net.sf.saxon.Transform" classpath="${saxon.dir}/saxon9.jar;." fork="true" failonerror="false">
                        <!--<arg value="-t"/> timing information -->
                        <arg value="-warnings:recover"/> <!-- recover after writing a warning message -->
                        <arg value="-o"/>
                        <arg value="@{scene}.@{extension}"/>
                        <arg value="@{scene}.x3d"/>
                        <arg value="@{stylesheet}"/>
                    </java> 
                </else>
            </if>
        </sequential>
    </macrodef>

    <!-- target tasks ===================================================================== -->
    
    <target name="all" depends="clean.backups,compile.stylesheets,commonSetup,convertCmlScenes,validate.all,create.buildFile.all" description="fully rebuild and zip each of the example archives" >
        <!-- output directory is relative to specified base dir -->
    <!--
        <parallel>
            <ant dir="Basic"              target="all" output="build.out.txt"/>
            <ant dir="ConformanceNist"    target="all" output="build.out.txt"/>
            <ant dir="Savage"             target="all" output="build.out.txt"/>
            <ant dir="SavageDefense"      target="all" output="build.out.txt"/>
            <ant dir="Vrml2.0Sourcebook"  target="all" output="build.out.txt"/>
            <ant dir="X3dForAdvancedModeling"   target="all" output="build.out.txt"/>
            <ant dir="X3dForWebAuthors"   target="all" output="build.out.txt"/>
        </parallel>
        <antcall target="sftp.uploadExampleUpdates"/>
        
        <parallel>
        </parallel>
    -->
            <antcall target="all.web3d"/>
            <antcall target="all.savage"/>
    </target>

    <target name="all.faster" depends="clean.backups,compile.stylesheets,commonSetup,convertCmlScenes,validate.all,create.buildFile.all,processScenes.all,catalog.generateHtmlPages.all,zip.all,sftp.uploadExampleUpdates"
        description="faster update all and upload, catalogs not rebuilt" >
    </target>

    <target name="HelloWorld" description="Copy HelloWorld.x3d example from common example archives and convert to other encodings">
        <ant dir="Basic" target="HelloWorld"/>
    </target>

    <target name="newScene" description="Copy newScene example from common example archives and convert to other encodings">
        <ant dir="Basic" target="newScene"/>
    </target>

    <target name="all.savage" depends="compile.stylesheets,commonSetup,create.buildFile.Savage,create.buildFile.SavageDefense" description="fully rebuild and zip each of the Savage example archives" >
        <parallel>
            <sequential>
                <ant dir="SavageDefense"      target="all" output="build.out.txt"/>
                 <!-- <antcall target="sftp.uploadExampleUpdates.SavageDefense"/> -->
            </sequential>
            <sequential>
                <ant dir="Savage"             target="all" output="build.out.txt"/>
                 <!-- <antcall target="sftp.uploadExampleUpdates.Savage"/> -->
            </sequential>
        </parallel>
    </target>

    <target name="all.web3d" depends="compile.stylesheets,commonSetup,convertCmlScenes,create.buildFile.Basic,create.buildFile.ConformanceNist,create.buildFile.Vrml2.0Sourcebook" description="fully rebuild and zip each of the Web3D example archives" >
        <parallel>
            <ant dir="Basic"                  target="all" output="build.out.txt"/> <!-- output directory is relative to specified base dir -->
            <ant dir="ConformanceNist"        target="all" output="build.out.txt"/>
            <ant dir="Vrml2.0Sourcebook"      target="all" output="build.out.txt"/>
            <ant dir="X3dForAdvancedModeling" target="all" output="build.out.txt"/>
            <ant dir="X3dForWebAuthors"       target="all" output="build.out.txt"/>
        </parallel>
        <antcall target="sftp.uploadExampleUpdates.web3d.all"/>
    </target>
    
    <target name="catalog.all" depends="" description="run catalog task for each of the example archives" >
        <ant dir="Basic"              target="catalog"/>
        <ant dir="ConformanceNist"    target="catalog"/>
        <ant dir="Vrml2.0Sourcebook"  target="catalog"/>
        <ant dir="Savage"             target="catalog"/>
        <ant dir="SavageDefense"      target="catalog"/>
        <ant dir="X3dForAdvancedModeling"   target="catalog"/>
        <ant dir="X3dForWebAuthors"   target="catalog"/>
    </target>
    
    <target name="catalog.generateHtmlPages.all" depends="" description="run catalog.generateHtmlPages task for each of the example archives" >
        <ant dir="Basic"              target="catalog.generateHtmlPages"/>
        <ant dir="ConformanceNist"    target="catalog.generateHtmlPages"/>
        <ant dir="Vrml2.0Sourcebook"  target="catalog.generateHtmlPages"/>
        <ant dir="Savage"             target="catalog.generateHtmlPages"/>
        <ant dir="SavageDefense"      target="catalog.generateHtmlPages"/>
        <ant dir="X3dForAdvancedModeling"   target="catalog.generateHtmlPages"/>
        <ant dir="X3dForWebAuthors"   target="catalog.generateHtmlPages"/>
    </target>
    
    <target name="processScenes.all" depends="" description="processScenes for each of the example archives" >
        <ant dir="Basic"              target="processScenes"/>
        <ant dir="ConformanceNist"    target="processScenes"/>
        <ant dir="Vrml2.0Sourcebook"  target="processScenes"/>
        <ant dir="Savage"             target="processScenes"/>
        <ant dir="SavageDefense"      target="processScenes"/>
        <ant dir="X3dForAdvancedModeling"   target="processScenes"/>
        <ant dir="X3dForWebAuthors"   target="processScenes"/>
    </target>

    <target name="processScenes.X3dToXhtml" depends="clean.backups" description="processScenes.X3dToXhtml for each of the example archives" >
        <echo message="processScenes.X3dToXhtml in example archives"/>
        <ant dir="Basic"              target="processScenes.X3dToXhtml"/>
        <ant dir="ConformanceNist"    target="processScenes.X3dToXhtml"/>
        <ant dir="Vrml2.0Sourcebook"  target="processScenes.X3dToXhtml"/>
        <ant dir="Savage"             target="processScenes.X3dToXhtml"/>
        <ant dir="SavageDefense"      target="processScenes.X3dToXhtml"/>
        <ant dir="X3dForAdvancedModeling"   target="processScenes.X3dToXhtml"/>
        <ant dir="X3dForWebAuthors"   target="processScenes.X3dToXhtml"/>
    </target>

    <target name="processScenes.canonicalX3D" description="processScenes.canonicalX3D for each of the example archives" >
        <echo message="processScenes.X3dToXhtml in example archives"/>
        <ant dir="Basic"              target="processScenes.canonicalX3D"/>
        <ant dir="ConformanceNist"    target="processScenes.canonicalX3D"/>
        <ant dir="Vrml2.0Sourcebook"  target="processScenes.canonicalX3D"/>
        <ant dir="Savage"             target="processScenes.canonicalX3D"/>
        <ant dir="SavageDefense"      target="processScenes.canonicalX3D"/>
        <ant dir="X3dForAdvancedModeling"   target="processScenes.canonicalX3D"/>
        <ant dir="X3dForWebAuthors"   target="processScenes.canonicalX3D"/>
    </target>

    <target name="processScenes.captureViewpoints" description="processScenes.captureViewpoints for each of the example archives, use Xj3D to create snapshot pictures of each viewpoint" >
        <!-- TODO Xj3D bug:  these tasks launch a window for each scene to perform offline rendering, instead needs to work headless -->
        <echo message="processScenes.X3dToXhtml in example archives"/>
        <ant dir="Basic"              target="processScenes.captureViewpoints"/>
        <ant dir="ConformanceNist"    target="processScenes.captureViewpoints"/>
        <ant dir="Vrml2.0Sourcebook"  target="processScenes.captureViewpoints"/>
        <ant dir="Savage"             target="processScenes.captureViewpoints"/>
        <ant dir="SavageDefense"      target="processScenes.captureViewpoints"/>
        <ant dir="X3dForAdvancedModeling"   target="processScenes.captureViewpoints"/>
        <ant dir="X3dForWebAuthors"   target="processScenes.captureViewpoints"/>
    </target>

    <target name="refresh.local.all" depends="" description="refresh each of the example archives" >
        <ant dir="Basic"              target="refresh.local"/>
        <ant dir="ConformanceNist"    target="refresh.local"/>
        <ant dir="Vrml2.0Sourcebook"  target="refresh.local"/>
        <ant dir="Savage"             target="refresh.local"/>
        <ant dir="SavageDefense"      target="refresh.local"/>
        <ant dir="X3dForAdvancedModeling"   target="refresh.local"/>
        <ant dir="X3dForWebAuthors"   target="refresh.local"/>
    </target>

    <target name="refresh.upload.all" depends="" description="refresh each of the example archives" >
        <ant dir="Basic"              target="refresh.upload"/>
        <ant dir="ConformanceNist"    target="refresh.upload"/>
        <ant dir="Vrml2.0Sourcebook"  target="refresh.upload"/>
        <ant dir="Savage"             target="refresh.upload"/>
        <ant dir="SavageDefense"      target="refresh.upload"/>
        <ant dir="X3dForAdvancedModeling"   target="refresh.upload"/>
        <ant dir="X3dForWebAuthors"   target="refresh.upload"/>
    </target>
    
    <target name="clean.all" depends="clean.backups" description="clean out cautogenerated files in example archives" >
        <echo message="clean/delete backup files in example archives"/>
        <ant dir="Basic"              target="clean.all"/>
        <ant dir="ConformanceNist"    target="clean.all"/>
        <ant dir="Vrml2.0Sourcebook"  target="clean.all"/>
        <ant dir="Savage"             target="clean.all"/>
        <ant dir="SavageDefense"      target="clean.all"/>
        <ant dir="X3dForAdvancedModeling"   target="clean.all"/>
        <ant dir="X3dForWebAuthors"   target="clean.all"/>
    </target>
    
    <target name="clean.html" depends="clean.backups" description="clean out autogenerated html files in example archives" >
        <echo message="clean/delete autogenerated html files in example archives"/>
        <ant dir="Basic"              target="clean.html"/>
        <ant dir="ConformanceNist"    target="clean.html"/>
        <ant dir="Vrml2.0Sourcebook"  target="clean.html"/>
        <ant dir="Savage"             target="clean.html"/>
        <ant dir="SavageDefense"      target="clean.html"/>
        <ant dir="X3dForAdvancedModeling"   target="clean.html"/>
        <ant dir="X3dForWebAuthors"   target="clean.html"/>
    </target>

    <target name="clean.SVG" depends="clean.backups" description="clean out autogenerated svg files in example archives" >
        <echo message="clean/delete autogenerated svg files in example archives"/>
        <ant dir="Basic"              target="clean.SVG"/>
        <ant dir="ConformanceNist"    target="clean.SVG"/>
        <ant dir="Vrml2.0Sourcebook"  target="clean.SVG"/>
        <ant dir="Savage"             target="clean.SVG"/>
        <ant dir="SavageDefense"      target="clean.SVG"/>
        <ant dir="X3dForAdvancedModeling"   target="clean.SVG"/>
        <ant dir="X3dForWebAuthors"   target="clean.SVG"/>
    </target>

    <target name="update.slideshowTools" description="clean out downloaded slideshow tools" >
        <echo message="clean out downloaded slideshow tools in example archives"/>
        <ant dir="Basic"              target="clean.slideshowTools"/>
        <ant dir="ConformanceNist"    target="clean.slideshowTools"/>
        <ant dir="Vrml2.0Sourcebook"  target="clean.slideshowTools"/>
        <ant dir="Savage"             target="clean.slideshowTools"/>
        <ant dir="SavageDefense"      target="clean.slideshowTools"/>
        <ant dir="X3dForAdvancedModeling"   target="clean.slideshowTools"/>
        <ant dir="X3dForWebAuthors"   target="clean.slideshowTools"/>
        <echo message="download currently tested slideshow tools into example archives"/>
        <ant dir="Basic"              target="get.slideshowTools"/>
        <ant dir="ConformanceNist"    target="get.slideshowTools"/>
        <ant dir="Vrml2.0Sourcebook"  target="get.slideshowTools"/>
        <ant dir="Savage"             target="get.slideshowTools"/>
        <ant dir="SavageDefense"      target="get.slideshowTools"/>
        <ant dir="X3dForAdvancedModeling"   target="get.slideshowTools"/>
        <ant dir="X3dForWebAuthors"   target="get.slideshowTools"/>
    </target>
    
    <target name="clean.backups" depends="" description="clean out residual backup files" >
        <echo message="clean/delete backup files"/>
        <delete verbose="true">
          <fileset dir="." includes="_new_pretty_print.html"/>
            <fileset dir="." includes="_new_result.wrl"/>
            <fileset dir="." includes="_new_result.x3dv"/>
            <fileset dir="." includes="_new_result.x3db"/>
            <fileset dir="." includes="_new_resultCanonical.xml"/>
            <fileset dir="." includes="Thumb.db"/>
            <fileset dir="." includes="*.bak"/>
            <fileset dir="." includes="*.$$$$$$"/> <!--escaped .$$$ -->
            <fileset dir="." includes="**/Untitled-?.x3d"/>
        </delete>
    </target>
    
    <target name="clean.archives" depends="" description="clean out autogenerated files in example _archive, archive subdirectories" >
        <echo message="clean/delete files in example _archive directories"/>
        <delete includeEmptyDirs="true" failonerror="false">
            <fileset dir="_archive/"/>
            <fileset dir="*/_archive/"/>
            <fileset dir="*/*/_archive/"/>
            <fileset dir="*/*/*/_archive/"/>
            <fileset dir="archive/"/>
            <fileset dir="*/archive/"/>
            <fileset dir="*/*/archive/"/>
            <fileset dir="*/*/*/archive/"/>
        </delete>
    </target>
    
    <target name="commonSetup" depends="compile.stylesheets,HelloWorldCopyToArchives" description="HelloWorld and newScene preparation for examples directory" >
        <copy file="HelloWorld.x3d" todir="Basic"/>
        <ant dir="Basic" target="HelloWorld"/>
        <copy todir="." verbose="true">
            <fileset dir="Basic" includes="HelloWorld.*"/>
        </copy>
        <copy file="newScene.x3d" todir="Basic"/>
        <ant dir="Basic" target="newScene"/>
        <copy todir="." verbose="true">
            <fileset dir="Basic" includes="newScene.*"/>
        </copy>
    </target>

    <target name="clean.stylesheets" depends="" description="remove compiled stylesheets" >
        <ant dir="../../stylesheets/" target="clean.stylesheets"/>
    </target>

    <target name="compile.stylesheets" depends="" description="compile stylesheets using Saxon" >
        <ant dir="../../stylesheets/" target="compile.stylesheets"/>
    </target>
    
    <target name="create.buildFile.all" depends="create.buildFile.Basic,create.buildFile.ConformanceNist,create.buildFile.Vrml2.0Sourcebook,create.buildFile.Savage,create.buildFile.SavageDefense,create.buildFile.X3dForAdvancedModeling,create.buildFile.X3dForWebAuthors"
        description="create and customize each X3D archive build.xml" >
        <!-- all work performed by dependency targets -->
    </target>
     
    <macrodef name="create.buildFile.xml" description="Invoke XSLT transformation on passed scene using passed stylesheet">
        <attribute name="archive.name"/>
        <sequential>
            <!-- TODO:  output needs updated directory name, directory title, directoryfilters, creation timestamp -->
            <copy    file="@{archive.name}/build.xml" todir="@{archive.name}/_archive/" overwrite="true" failonerror="false"/>
            <copy  tofile="@{archive.name}/build.xml" file="buildExamplesTemplate.xml" overwrite="true"/>
            <copy  tofile="@{archive.name}/CatalogManager.properties" file="../../tools/CreateContentCatalog/CatalogManager.properties" overwrite="true"/>
            <if>
                <or>
                    <equals arg1="@{archive.name}" arg2="Basic" />
                    <equals arg1="@{archive.name}" arg2="Vrml2.0Sourcebook" />
                    <equals arg1="@{archive.name}" arg2="X3dForAdvancedModeling" />
                    <equals arg1="@{archive.name}" arg2="X3dForWebAuthors" />
                </or>
                <then>
                    <echo>Set numberOfSections="1":</echo>
                    <replace file="@{archive.name}/build.xml" token="_numberOfSections_" value="1" summary="true"/>
                    <replace file="@{archive.name}/build.xml" token="_subdir_"  value="*" summary="true"/>
                    <echo>Set X3D and XML fileset filters:</echo>
                    <replace file="@{archive.name}/build.xml" token="_x3dScenes_"   value="*/*.x3d"  summary="true"/>
                    <replace file="@{archive.name}/build.xml" token="_xmlFiles_"    value="*/*.xml"  summary="true"/>
                    <replace file="@{archive.name}/build.xml" token="_regexp2_"     value="()()()"   summary="true"/>
                </then>
                <else>
                    <!-- archive.name: ConformanceNIST, Savage, SavageDefense -->
                    <echo>Set numberOfSections="2":</echo>
                    <replace file="@{archive.name}/build.xml" token="_numberOfSections_" value="2" summary="true"/>
                    <replace file="@{archive.name}/build.xml" token="_subdir_" value="*/*" summary="true"/>
                    <echo>Set X3D and XML fileset filters:</echo>
                    <replace file="@{archive.name}/build.xml" token="_x3dScenes_"   value="*/*/*.x3d"  summary="true"/>
                    <replace file="@{archive.name}/build.xml" token="_xmlFiles_"    value="*/*/*.xml"  summary="true"/>
                    <replace file="@{archive.name}/build.xml" token="_regexp2_"     value="([^\n]*)_archiveName_[\\/]([^\n^\\^/]*)[\\/]([^\n^\\^/]*)([\\/][^\n]*)\.x3d"   summary="true"/>
                </else>
            </if>
            <echo>Set archive name to @{archive.name}:</echo>
            <replace file="@{archive.name}/build.xml" token="_archiveName_"      value="@{archive.name}" summary="true"/>
            <echo>Validate @{archive.name}/build.xml:</echo>
            <xmlvalidate failonerror="true" warn="true" lenient="yes">
                <fileset dir=".">
                    <include name="@{archive.name}/build.xml"/>
                </fileset>
            </xmlvalidate>
            <echo>create.buildFile.xml @{archive.name} complete</echo>
            <echo>==================================</echo>
        </sequential>
    </macrodef>
    
    <target name="validate.buildExamplesTemplate.xml" depends="" description="validate buildExamplesTemplate.xml" >
        <xmlvalidate failonerror="true" warn="true" lenient="yes">
            <fileset dir=".">
                <include name="buildExamplesTemplate.xml"/>
            </fileset>
        </xmlvalidate>
    </target>
    
    <target name="create.buildFile.Basic" depends="validate.buildExamplesTemplate.xml" description="create and customize archive build.xml for www.web3d.org/x3d/content/examples/Basic/" >
        <create.buildFile.xml archive.name="Basic"/>
    </target>
    
    <target name="create.buildFile.ConformanceNist" depends="validate.buildExamplesTemplate.xml" description="create and customize archive build.xml for www.web3d.org/x3d/content/examples/ConformanceNist/" >
        <create.buildFile.xml archive.name="ConformanceNist"/>
    </target>
    
    <target name="create.buildFile.Vrml2.0Sourcebook" depends="validate.buildExamplesTemplate.xml" description="create and customize archive build.xml for www.web3d.org/x3d/content/examples/Vrml2.0Sourcebook/" >
        <create.buildFile.xml archive.name="Vrml2.0Sourcebook"/>
    </target>
    
    <target name="create.buildFile.Savage" depends="validate.buildExamplesTemplate.xml" description="create and customize archive build.xml for www.web3d.org/x3d/content/examples/Savage/" >
        <create.buildFile.xml archive.name="Savage"/>
    </target>
    
    <target name="create.buildFile.SavageDefense" depends="validate.buildExamplesTemplate.xml" description="create and customize archive build.xml for www.web3d.org/x3d/content/examples/SavageDefense/" >
        <create.buildFile.xml archive.name="SavageDefense"/>
    </target>
    
    <target name="create.buildFile.X3dForAdvancedModeling" depends="validate.buildExamplesTemplate.xml" description="create and customize archive build.xml for www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/" >
        <create.buildFile.xml archive.name="X3dForAdvancedModeling"/>
    </target>
    
    <target name="create.buildFile.X3dForWebAuthors" depends="validate.buildExamplesTemplate.xml" description="create and customize archive build.xml for www.web3d.org/x3d/content/examples/X3dForWebAuthors/" >
        <create.buildFile.xml archive.name="X3dForWebAuthors"/>
    </target>

    <!-- ============================================================================== -->
  
    <!-- SFTP ssh taskdef. this requires maverick-ant installed                                -->
    <!-- Maverick ssh/sftp ant task provided at http://www.sshtools.com/showMaverickAntTask.do -->
    <!-- Configuration prerequisite: move maverick.jar to local ant/lib/                       -->
    <taskdef  name="ssh" classname="com.sshtools.ant.Ssh"/>

    <!-- TODO verify maverick operation... -->
    <!-- recursing via includes="**/*.*" doesn't preserve directory structure on client side, likely due to sftp limitation  -->
    <!-- thus must use .zip, .tar.gz (.tgz) to preserve archive structure  -->

    <!-- ============================================================================== -->

    <target name="sftp.askUsernamePassword.savage"
        description="If needed, ask for username, password">
        <if>
            <not>
                <and>
                    <isset property="username.savage"/>
                    <isset property="password.savage"/>
                </and>
            </not>
            <then>
                <echo  message="username.savage:, password.savage not obtained via file ${access.properties.filename}"/> 
                <input message="username.savage:"
                addproperty="username.savage" />
                <input message="password.savage:"
                addproperty="password.savage" />
                <echo  message="username.savage=${username.savage}"/>
                <echo  message="password.savage=################"/> 
                <!--<echo  message="password.savage=${password.savage}"/> debug -->
            </then>
            <else>
                <echo  message="username.savage, password.savage obtained from file ${access.properties.filename}"/> 
            </else>
        </if>
    </target>
  
    <target name="sftp.askUsernamePassword.savageDefense"
        description="If needed, ask for username, password">
        <if>
            <not>
                <and>
                    <isset property="username.savageDefense"/>
                    <isset property="password.savageDefense"/>
                </and>
            </not>
            <then>
                <echo  message="username.savageDefense:, password.savageDefense not obtained via file ${access.properties.filename}"/> 
                <input message="username.savageDefense:"
                addproperty="username.savageDefense" />
                <input message="password.savageDefense:"
                addproperty="password.savageDefense" />
                <echo  message="username.savageDefense=${username.savageDefense}"/>
                <echo  message="password.savageDefense=################"/> 
                <!--<echo  message="password.savageDefense=${password.savageDefense}"/> debug -->
            </then>
            <else>
                <echo  message="username.savageDefense, password.savageDefense obtained from file ${access.properties.filename}"/> 
            </else>
        </if>
    </target>
  
    <target name="sftp.askUsernamePassword.web3d"
        description="If needed, ask for username, password">
        <if>
            <not>
                <and>
                    <isset property="username.web3d"/>
                    <isset property="password.web3d"/>
                </and>
            </not>
            <then>
                <echo  message="username.web3d, password.web3d not obtained via file ${access.properties.filename}"/> 
                <input message="username.web3d:"
                addproperty="username.web3d" />
                <input message="password.web3d:"
                addproperty="password.web3d" />
                <echo  message="username.web3d=${username.web3d}"/>
                <echo  message="password.web3d=################"/> 
                <!--<echo  message="password.web3d=${password.web3d}"/> debug -->
            </then>
            <else>
                <echo  message="username.web3d, password.web3d obtained from file ${access.properties.filename}"/> 
            </else>
        </if>
    </target>
  
    <target name="sftp.askUsernamePassword.X3dForAdvancedModeling"
        description="If needed, ask for username, password">
        <if>
            <not>
                <and>
                    <isset property="username.X3dForWebAuthors"/>
                    <isset property="password.X3dForWebAuthors"/>
                </and>
            </not>
            <then>
                <echo  message="username.X3dForWebAuthors, password.X3dForWebAuthors not obtained via file ${access.properties.filename}"/> 
                <input message="username.X3dForWebAuthors:"
                   addproperty="username.X3dForWebAuthors" />
                <input message="password.X3dForWebAuthors:"
                   addproperty="password.X3dForWebAuthors" />
                <echo  message="username.X3dForWebAuthors=${username.X3dForWebAuthors}"/>
                <echo  message="password.X3dForWebAuthors=################"/> 
                <!--<echo  message="password.web3d=${password.X3dForWebAuthors}"/> debug -->
            </then>
            <else>
                <echo  message="username.X3dForWebAuthors, password.X3dForWebAuthors obtained from file ${access.properties.filename}"/> 
            </else>
        </if>
    </target>
  
    <target name="sftp.askUsernamePassword.X3dForWebAuthors"
        description="If needed, ask for username, password">
        <if>
            <not>
                <and>
                    <isset property="username.X3dForWebAuthors"/>
                    <isset property="password.X3dForWebAuthors"/>
                </and>
            </not>
            <then>
                <echo  message="username.X3dForWebAuthors, password.X3dForWebAuthors not obtained via file ${access.properties.filename}"/> 
                <input message="username.X3dForWebAuthors:"
                   addproperty="username.X3dForWebAuthors" />
                <input message="password.X3dForWebAuthors:"
                   addproperty="password.X3dForWebAuthors" />
                <echo  message="username.X3dForWebAuthors=${username.X3dForWebAuthors}"/>
                <echo  message="password.X3dForWebAuthors=################"/> 
                <!--<echo  message="password.web3d=${password.X3dForWebAuthors}"/> debug -->
            </then>
            <else>
                <echo  message="username.X3dForWebAuthors, password.X3dForWebAuthors obtained from file ${access.properties.filename}"/> 
            </else>
        </if>
    </target>
    
    <!-- TODO:  figure out if possible to repeat upload until successful, countering loss of sftp connection failure -->

    <target name="sftp.update.DeveloperPages" depends="sftp.askUsernamePassword.savage,sftp.askUsernamePassword.savageDefense"
        description="sftp upload of updated developers and subversion help pages for Savage, SavageDefense">
        <!-- first update savage, then update savageDefense -->
        <echo  message="sftp upload to sftp://${sftpServer.savage}/${sftpDirectory.savage}"/>
        <ssh host="${sftpServer.savage}"
            username="${username.savage}"
            password="${password.savage}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savage}">
                <fileset dir=".">
                    <include name="indexSavage.redirect.html"/>
                    <include name="indexSavageChat.redirect.html"/>
                    <include name="indexSavageDevelopers.redirect.html"/>
                    <include name="indexSavageSubversion.redirect.html"/>
                </fileset>
            </sftp>
        </ssh>
        <ssh host="${sftpServer.savage}"
            username="${username.savage}"
            password="${password.savage}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savage}/Savage">
                <fileset dir="Savage">
                    <include name="chat.html"/>
                    <include name="developers.html"/>
                    <include name="subversion.html"/>
                    <include name="images/*.png"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="sftp upload to sftp://${sftpServer.savageDefense}/${sftpDirectory.savageDefense}"/>
        <ssh host="${sftpServer.savageDefense}"
            username="${username.savageDefense}"
            password="${password.savageDefense}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savageDefense}">
                <fileset dir=".">
                    <include name="indexSavageDefense.redirect.html"/>
                    <include name="indexSavageDefenseDevelopers.redirect.html"/>
                    <include name="indexSavageDefenseSubversion.redirect.html"/>
                </fileset>
            </sftp>
        </ssh>
        <ssh host="${sftpServer.savageDefense}"
            username="${username.savageDefense}"
            password="${password.savageDefense}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savageDefense}/SavageDefense">
                <fileset dir="SavageDefense">
                    <include name="developers.html"/>
                    <include name="subversion.html"/>
                    <include name="images/*.png"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="sftp.update.DeveloperPages ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates" depends="sftp.uploadExampleUpdates.web3d.all,sftp.uploadExampleUpdates.Savage,sftp.uploadExampleUpdates.SavageDefense,sftp.uploadExampleUpdates.X3dForWebAuthors,sftp.uploadExampleUpdates.X3dForAdvancedModeling"
        description="sftp upload all updated X3D archive files">
        <!-- TODO:  convert other sftp.uploadExampleUpdates tasks into macros -->
    </target>

    <target name="sftp.uploadExampleUpdates.Savage" depends="sftp.uploadExampleUpdates.Savage.scenes,sftp.uploadExampleUpdates.Savage.zip"
        description="sftp upload of updated X3D archive files, including .zip">
    </target>

    <target name="sftp.uploadExampleUpdates.Savage.scenes" depends="sftp.askUsernamePassword.savage,sftp.uploadExampleUpdates.web3d.common"
        description="sftp upload of updated X3D archive files, not including .zip">
        <echo  message="sftp upload to sftp://${sftpServer.savage}/${sftpDirectory.savage}"/>
        <ssh host="${sftpServer.savage}"
            username="${username.savage}"
            password="${password.savage}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="true"
                skipfailedtransfers="true"
                remotedir="${sftpDirectory.savage}">
                <fileset dir=".">
                    <include name="indexSavage.redirect.html"/>
                    <include name="help.html"/>
                    <include name="license.*"/>
                    <include name="images/*"/>
                    <include name="Savage/*"/>
                    <include name="Savage/**/*"/>
                    <!-- excluding these -->
                    <exclude name="X3dResources.html"/>
                    <exclude name="X3dSceneAuthoringHints.html"/>
                    <exclude name="X3dExamplesSavage.zip"/>
                    <exclude name="**/archive/*"/>
                    <exclude name="**/_archive/*"/>
                    <exclude name="_schematron/*"/>
                    <exclude name="**/_schematron/*"/>
                    <exclude name="**/_hide/*"/>
                    <exclude name="**/hide/*"/>
                    <exclude name="**/CVS/*"/>
                    <exclude name="**/.svn/*"/>
                    <exclude name="**/_new*.*"/>
                    <exclude name="**/*.bak"/>
                    <exclude name="**/Thumbs.db"/>
                    <exclude name="nbproject/*"/>
                    <exclude name="**/nbproject/*"/>
                    <exclude name="CVS/"/>
                    <exclude name="*/CVS/"/>
                    <exclude name=".svn/"/>
                    <exclude name="**/.svn"/>
                    <exclude name="**/*.$$$"/>
                    <exclude name="**/*.\$\$\$"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at https://${sftpServer.savage}/Savage"/>
        <echo  message="sftp.uploadExampleUpdates.Savage.scenes ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadSavageStudioExcerpt.zip" depends="sftp.askUsernamePassword.savage"
        description="sftp upload of updated X3D X3dExamplesSavageStudioExcerpt.zip archive">
        <echo  message="sftp upload to sftp://${sftpServer.savage}/${sftpDirectory.savage}"/>
        <ssh host="${sftpServer.savage}"
            username="${username.savage}"
            password="${password.savage}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savage}">
                <fileset dir=".">
                    <include name="X3dExamplesSavageStudioExcerpt.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at https://${sftpServer.savage}/X3dExamplesSavageStudioExcerpt.zip"/>
        <echo  message="sftp.uploadSavageStudioExcerpt.zip ssh-sftp task complete"/>
    </target>

    <target name="sftp.update.CommonFiles" depends="sftp.askUsernamePassword.web3d,sftp.askUsernamePassword.X3dForWebAuthors,sftp.askUsernamePassword.savage,sftp.askUsernamePassword.savageDefense"
        description="sftp upload of X3dResources.html and other common files on all online example archives">
        <echo  message="web3D.org connect..."/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="true" 
                skipfailedtransfers="true" 
                remotedir="${sftpDirectory.web3d}" >
                <fileset dir=".">
                    <!-- these files are only updated as master versions on web3d.org, redirect pages are used elsewhere -->
                    <include name="X3dResources.html"/>
                    <include name="X3dSceneAuthoringHints.html"/>
                </fileset>
                <!-- the following files are common to all of the example archive sites -->
                <fileset refid="web3d.common.fileset"/>
            </sftp>
        </ssh>
        <echo  message="========= web3D.org update.common complete ========="/>

        <echo  message="X3dGraphics.com connect..."/>
        <ssh host="${sftpServer.X3dForWebAuthors}"
            username="${username.X3dForWebAuthors}"
            password="${password.X3dForWebAuthors}">
            <sftp action="put" verbose="true"
                newer="true"
                skipfailedtransfers="true"
                remotedir="${sftpDirectory.X3dForWebAuthors}" >
                <fileset refid="web3d.common.fileset"/>
            </sftp>
            <sftp action="put" verbose="true"
                newer="true"
                skipfailedtransfers="true"
                remotedir="${sftpDirectory.X3dForAdvancedModeling}" >
                <fileset refid="web3d.common.fileset"/>
            </sftp>
        </ssh>
        <echo  message="========= X3dGraphics.com update.common complete ========="/>

        <echo  message="Savage connect..."/>
        <ssh host="${sftpServer.savage}"
            username="${username.savage}"
            password="${password.savage}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savage}/Savage">
                <fileset refid="web3d.common.fileset"/>
            </sftp>
        </ssh>
        <echo  message="========= Savage update.common complete ========="/>
        
        <echo  message="SavageDefense connect..."/>
        <ssh host="${sftpServer.savageDefense}"
            username="${username.savageDefense}"
            password="${password.savageDefense}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="true"
                skipfailedtransfers="true"
                remotedir="${sftpDirectory.savageDefense}/SavageDefense">
                <fileset refid="web3d.common.fileset"/>
            </sftp>
        </ssh>
        <echo  message="========= SavageDefense update.common complete ========="/>
    </target>

    <target name="sftp.uploadSavageAuvWorkbenchModelDistribution.zip" depends="sftp.askUsernamePassword.savage"
        description="sftp upload of updated X3D SavageAuvWorkbenchModelDistribution.zip archive">
        <echo  message="sftp upload to sftp://${sftpServer.savage}/${sftpDirectory.savage}"/>
        <ssh host="${sftpServer.savage}"
            username="${username.savage}"
            password="${password.savage}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savage}">
                <fileset dir=".">
                    <include name="X3dExamplesSavageAuvWorkbenchExcerpt.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at https://${sftpServer.savage}/X3dExamplesSavageAuvWorkbenchExcerpt.zip"/>
        <echo  message="sftp.uploadSavageAuvWorkbenchModelDistribution.zip ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.Savage.zip" depends="sftp.askUsernamePassword.savage"
        description="sftp upload of updated X3D Savage.zip archive">
        <echo  message="sftp upload to sftp://${sftpServer.savage}/${sftpDirectory.savage}"/>
        <ssh host="${sftpServer.savage}"
            username="${username.savage}"
            password="${password.savage}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savage}">
                <fileset dir=".">
                    <include name="X3dExamplesSavage.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at https://${sftpServer.savage}/X3dExamplesSavage.zip"/>
        <echo  message="sftp.uploadExampleUpdates.Savage.zip ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.SavageDefense" depends="sftp.uploadExampleUpdates.SavageDefense.scenes,sftp.uploadExampleUpdates.SavageDefense.zip"
        description="sftp upload of updated X3D archive files, including .zip">
    </target>

    <target name="sftp.uploadExampleUpdates.SavageDefense.scenes" depends="sftp.askUsernamePassword.savageDefense,sftp.uploadExampleUpdates.web3d.common"
        description="sftp upload of updated X3D archive files, not including .zip">
        <echo  message="sftp upload to sftp://${sftpServer.savageDefense}/${sftpDirectory.savageDefense}"/>
        <ssh host="${sftpServer.savageDefense}"
            username="${username.savageDefense}"
            password="${password.savageDefense}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="true"
                skipfailedtransfers="true"
                remotedir="${sftpDirectory.savageDefense}">
                <fileset dir=".">
                    <include name="indexSavageDefense.redirect.html"/>
                    <include name="help.html"/>
                    <include name="license.*"/>
                    <include name="images/*"/>
                    <include name="SavageDefense/*"/>
                    <include name="SavageDefense/**/*"/>
                    <!-- excluding these -->
                    <exclude name="X3dExamplesSavageDefense.zip"/>
                    <exclude name="X3dResources.html"/>
                    <exclude name="X3dSceneAuthoringHints.html"/>
                    <exclude name="**/archive/*"/>
                    <exclude name="**/_archive/*"/>
                    <exclude name="_schematron/*"/>
                    <exclude name="**/_schematron/*"/>
                    <exclude name="**/_hide/*"/>
                    <exclude name="**/hide/*"/>
                    <exclude name="**/CVS/*"/>
                    <exclude name="**/.svn/*"/>
                    <exclude name="**/_new*.*"/>
                    <exclude name="**/*.bak"/>
                    <exclude name="**/Thumbs.db"/>
                    <exclude name="nbproject/*"/>
                    <exclude name="**/nbproject/*"/>
                    <exclude name="CVS/"/>
                    <exclude name="*/CVS/"/>
                    <exclude name=".svn/"/>
                    <exclude name="**/.svn"/>
                    <exclude name="**/*.$$$"/>
                    <exclude name="**/*.\$\$\$"/>
                </fileset>
            </sftp>
        </ssh>
        <!-- Exception:  Failed to initialise MIME mail: org.apache.tools.ant.taskdefs.email.MimeMailer
        <if>
            <isset property="notify.savageDefense"/>
            <then>
                <mail from="brutzman@nps.navy.mil(Don Brutzman)" tolist="notify.savageDefense" mailhost="${nps.mailhost}" password="${nps.password}"
                      subject="SavageDefense archive uploaded"
                      message="SavageDefense archive uploaded to https://${sftpServer.savageDefense}/SavageDefense"/>
            </then>
            <else>
                <echo  message="notification mail not sent, no value for property notify.savageDefense"/> 
            </else>
        </if>
        -->
        <echo  message="upload available at https://${sftpServer.savageDefense}/SavageDefense"/>
        <echo  message="sftp.uploadExampleUpdates.SavageDefense.scenes ssh-sftp task complete"/>
    </target>
    
    <target name="sftp.uploadExampleUpdates.SavageDefense.zip" depends="sftp.askUsernamePassword.savageDefense"
        description="sftp upload of updated X3D SavageDefense.zip archive">
        <echo  message="sftp upload to sftp://${sftpServer.savageDefense}/${sftpDirectory.savageDefense}"/>
        <ssh host="${sftpServer.savageDefense}"
            username="${username.savageDefense}"
            password="${password.savageDefense}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false"
                skipfailedtransfers="false"
                remotedir="${sftpDirectory.savageDefense}">
                <fileset dir=".">
                    <include name="X3dExamplesSavageDefense.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at https://${sftpServer.savageDefense}/X3dExamplesSavageDefense.zip"/>
        <echo  message="sftp.uploadExampleUpdates.SavageDefense.zip ssh-sftp task complete"/>
    </target>
    
        <!-- Exception:  Failed to initialise MIME mail: org.apache.tools.ant.taskdefs.email.MimeMailer
        <if>
            <isset property="notify.savageDTO"/>
            <then>
                <mail from="brutzman@nps.navy.mil(Don Brutzman)" tolist="notify.savageDTO" mailhost="${nps.mailhost}" password="${nps.password}"
                      subject="SavageDTO archive uploaded"
                      message="SavageDTO archive uploaded to https://${sftpServer.savageDTO}/SavageDTO"/>
            </then>
            <else>
                <echo  message="notification mail not sent, no value for property notify.savageDTO"/> 
            </else>
        </if>
        -->

    <target name="sftp.uploadExampleUpdates.web3d.all" depends="sftp.uploadExampleUpdates.web3d.common,sftp.uploadExampleUpdates.Basic,sftp.uploadExampleUpdates.Vrml2.0Sourcebook,sftp.uploadExampleUpdates.ConformanceNist"
        description="sftp upload of updated X3D archive files">
        <echo  message="sftp.uploadExampleUpdates.web3d.all ssh-sftp task complete"/>
    </target>

    <fileset id="web3d.common.fileset" dir=".">
        <include name="license.*"/>
        <include name="*.html"/>
        <include name="*.txt"/>
        <include name="*.xml"/>
        <include name="Hello*"/>
        <include name="earth-topo*"/>
        <include name="newScene*"/>
        <include name="images/*"/>
        <!-- excluding these -->
        <exclude name="X3dResources.html"/>
        <exclude name="X3dSceneAuthoringHints.html"/>
        <exclude name="indexSavage.redirect.html"/>
        <exclude name="indexSavageDefense.redirect.html"/>
        <exclude name="indexX3dForWebAuthors.redirect.html"/>
        <exclude name="**/archive/*"/>
        <exclude name="**/_archive/*"/>
        <exclude name="_schematron/*"/>
        <exclude name="**/_schematron/*"/>
        <exclude name="**/_hide/*"/>
        <exclude name="**/hide/*"/>
        <exclude name="**/CVS/*"/>
        <exclude name="**/.svn/*"/>
        <exclude name="**/_new*.*"/>
        <exclude name="**/*.bak"/>
        <exclude name="**/Thumbs.db"/>
        <exclude name="nbproject/*"/>
        <exclude name="**/nbproject/*"/>
        <exclude name="CVS/"/>
        <exclude name="*/CVS/"/>
        <exclude name=".svn/"/>
        <exclude name="**/.svn/"/>
        <exclude name="**/*.$$$"/>
        <exclude name="**/*.\$\$\$"/>
    </fileset>

    <target name="sftp.uploadExampleUpdates.web3d.common" depends=""
        description="sftp upload of shared updated X3D archive files">
        <echo  message="sftp upload to sftp://${sftpServer.web3d}/${sftpDirectory.web3d}"/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="true"
                skipfailedtransfers="true"
                remotedir="${sftpDirectory.web3d}" >
                <fileset refid="web3d.common.fileset"/>
            </sftp>
        </ssh>
        <echo  message="sftp.uploadExampleUpdates.web3d.common ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.Basic" depends="sftp.uploadExampleUpdates.Basic.scenes,sftp.uploadExampleUpdates.Basic.zip"
        description="sftp upload of updated X3D Basic archive files, including .zip">
    </target>

    <target name="sftp.uploadExampleUpdates.Basic.scenes" depends="sftp.askUsernamePassword.web3d"
        description="sftp upload of updated X3D Basic archive files, not including .zip">
        <echo  message="sftp upload to sftp://${sftpServer.web3d}/${sftpDirectory.web3d}"/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="true" 
                skipfailedtransfers="true" 
                remotedir="${sftpDirectory.web3d}" >
                <fileset refid="web3d.common.fileset"/>
                <fileset dir=".">
                    <include name="Basic/*"/>
                    <include name="Basic/**/*"/>
                    <!-- excluding these -->
                    <exclude name="X3dResources.html"/>
                    <exclude name="X3dSceneAuthoringHints.html"/>
                    <exclude name="X3dExamplesBasic.zip"/>
                    <exclude name="indexSavage.redirect.html"/>
                    <exclude name="indexSavageDefense.redirect.html"/>
                    <exclude name="indexX3dForWebAuthors.redirect.html"/>
                    <exclude name="**/*.nrrd"/>
                    <exclude name="**/archive/*"/>
                    <exclude name="**/_archive/*"/>
                    <exclude name="_schematron/*"/>
                    <exclude name="**/_schematron/*"/>
                    <exclude name="**/_hide/*"/>
                    <exclude name="**/hide/*"/>
                    <exclude name="**/CVS/*"/>
                    <exclude name="**/.svn/*"/>
                    <exclude name="**/_new*.*"/>
                    <exclude name="**/*.bak"/>
                    <exclude name="**/Thumbs.db"/>
                    <exclude name="nbproject/*"/>
                    <exclude name="**/nbproject/*"/>
                    <exclude name="CVS/"/>
                    <exclude name="*/CVS/"/>
                    <exclude name=".svn/"/>
                    <exclude name="**/.svn/"/>
                    <exclude name="**/*.$$$"/>
                    <exclude name="**/*.\$\$\$"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.web3d}/Basic"/>
        <echo  message="sftp.uploadExampleUpdates.Basic.scenes ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.Basic.zip" depends="sftp.askUsernamePassword.web3d"
        description="sftp upload of updated X3D Basic archive .zip">
        <echo  message="sftp upload to sftp://${sftpServer.web3d}/${sftpDirectory.web3d}"/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false" 
                skipfailedtransfers="false" 
                remotedir="${sftpDirectory.web3d}" >
                <fileset dir=".">
                    <include name="X3dExamplesBasic.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.web3d}/X3dExamplesBasic.zip"/>
        <echo  message="sftp.uploadExampleUpdates.Basic.zip ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.ConformanceNist" depends="sftp.uploadExampleUpdates.ConformanceNist.scenes,sftp.uploadExampleUpdates.ConformanceNist.zip"
        description="sftp upload of updated X3D archive files, including .zip">
    </target>

    <target name="sftp.uploadExampleUpdates.ConformanceNist.scenes" depends="sftp.askUsernamePassword.web3d"
        description="sftp upload of updated X3D archive files, not including .zip">
        <echo  message="sftp upload to sftp://${sftpServer.web3d}/${sftpDirectory.web3d}"/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="true" 
                skipfailedtransfers="true" 
                remotedir="${sftpDirectory.web3d}" >
                <fileset refid="web3d.common.fileset"/>
                <fileset dir=".">
                    <include name="ConformanceNist/*"/>
                    <include name="ConformanceNist/**/*"/>
                    <!-- excluding these -->
                    <exclude name="X3dExamplesConformanceNist.zip"/>
                    <exclude name="X3dResources.html"/>
                    <exclude name="X3dSceneAuthoringHints.html"/>
                    <exclude name="indexSavage.redirect.html"/>
                    <exclude name="indexSavageDefense.redirect.html"/>
                    <exclude name="indexX3dForWebAuthors.redirect.html"/>
                    <exclude name="**/archive/*"/>
                    <exclude name="**/_archive/*"/>
                    <exclude name="_schematron/*"/>
                    <exclude name="**/_schematron/*"/>
                    <exclude name="**/_hide/*"/>
                    <exclude name="**/hide/*"/>
                    <exclude name="**/CVS/*"/>
                    <exclude name="**/.svn/*"/>
                    <exclude name="**/_new*.*"/>
                    <exclude name="**/*.bak"/>
                    <exclude name="**/Thumbs.db"/>
                    <exclude name="nbproject/"/>
                    <exclude name="**/nbproject"/>
                    <exclude name=".svn/"/>
                    <exclude name="**/.svn"/>
                    <exclude name="**/*.$$$"/>
                    <exclude name="**/*.\$\$\$"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.web3d}/ConformanceNist"/>
        <echo  message="sftp.uploadExampleUpdates.ConformanceNist.scenes ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.ConformanceNist.zip" depends="sftp.askUsernamePassword.web3d"
        description="sftp upload of updated X3D ConformanceNist archive .zip">
        <echo  message="sftp upload to sftp://${sftpServer.web3d}/${sftpDirectory.web3d}"/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false" 
                skipfailedtransfers="false" 
                remotedir="${sftpDirectory.web3d}" >
                <fileset dir=".">
                    <include name="X3dExamplesConformanceNist.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.web3d}/X3dExamplesConformanceNist.zip"/>
        <echo  message="sftp.uploadExampleUpdates.ConformanceNist.zip ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.Vrml2.0Sourcebook" depends="sftp.uploadExampleUpdates.Vrml2.0Sourcebook.scenes,sftp.uploadExampleUpdates.Vrml2.0Sourcebook.zip"
        description="sftp upload of updated X3D archive files, including .zip">
    </target>

    <target name="sftp.uploadExampleUpdates.Vrml2.0Sourcebook.scenes" depends="sftp.askUsernamePassword.web3d"
        description="sftp upload of updated X3D archive files, not including .zip">
        <echo  message="sftp upload to sftp://${sftpServer.web3d}/${sftpDirectory.web3d}"/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="true" 
                skipfailedtransfers="true" 
                remotedir="${sftpDirectory.web3d}" >
                <fileset refid="web3d.common.fileset"/>
                <fileset dir=".">
                    <include name="Vrml2.0Sourcebook/*"/>
                    <include name="Vrml2.0Sourcebook/**/*"/>
                    <!-- excluding these -->
                    <exclude name="X3dExamplesVrml2.0Sourcebook.zip"/>
                    <exclude name="X3dResources.html"/>
                    <exclude name="X3dSceneAuthoringHints.html"/>
                    <exclude name="indexSavage.redirect.html"/>
                    <exclude name="indexSavageDefense.redirect.html"/>
                    <exclude name="indexX3dForWebAuthors.redirect.html"/>
                    <exclude name="**/archive/*"/>
                    <exclude name="**/_archive/*"/>
                    <exclude name="_schematron/*"/>
                    <exclude name="**/_schematron/*"/>
                    <exclude name="**/_hide/*"/>
                    <exclude name="**/hide/*"/>
                    <exclude name="**/CVS/*"/>
                    <exclude name="**/.svn/*"/>
                    <exclude name="**/_new*.*"/>
                    <exclude name="**/*.bak"/>
                    <exclude name="**/Thumbs.db"/>
                    <exclude name="nbproject/"/>
                    <exclude name="**/nbproject"/>
                    <exclude name=".svn/"/>
                    <exclude name="**/.svn"/>
                    <exclude name="**/*.$$$"/>
                    <exclude name="**/*.\$\$\$"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.web3d}/Vrml2.0Sourcebook"/>
        <echo  message="sftp.uploadExampleUpdates.Vrml2.0Sourcebook.scenes ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.Vrml2.0Sourcebook.zip" depends="sftp.askUsernamePassword.web3d"
        description="sftp upload of updated X3D Vrml2.0Sourcebook archive .zip">
        <echo  message="sftp upload to sftp://${sftpServer.web3d}/${sftpDirectory.web3d}"/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="put" verbose="true"
                newer="false" 
                skipfailedtransfers="false" 
                remotedir="${sftpDirectory.web3d}" >
                <fileset dir=".">
                    <include name="X3dExamplesVrml2.0Sourcebook.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.web3d}/X3dExamplesVrml2.0Sourcebook.zip"/>
        <echo  message="sftp.uploadExampleUpdates.Vrml2.0Sourcebook.zip ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.X3dForAdvancedModeling" depends="sftp.uploadExampleUpdates.X3dForAdvancedModeling.scenes,sftp.uploadExampleUpdates.X3dForAdvancedModeling.zip"
        description="sftp upload of updated X3D archive files, including .zip">
    </target>

    <target name="sftp.uploadExampleUpdates.X3dForAdvancedModeling.scenes" depends="sftp.askUsernamePassword.X3dForAdvancedModeling"
        description="sftp upload of updated X3D archive files, not including .zip">
        <echo  message="sftp upload to sftp://${sftpServer.X3dForWebAuthors}/${sftpDirectory.X3dForAdvancedModeling}"/>
        <ssh host="${sftpServer.X3dForWebAuthors}"
            username="${username.X3dForWebAuthors}"
            password="${password.X3dForWebAuthors}">
            <sftp action="put" verbose="true"
                newer="true" 
                skipfailedtransfers="true" 
                remotedir="${sftpDirectory.X3dForAdvancedModeling}" >
                <fileset refid="web3d.common.fileset"/>
                <fileset dir=".">
                    <!-- future book directories will immediately follow the next include entries -->
                    <include name="X3dForAdvancedModeling/*"/>
                    <include name="X3dForAdvancedModeling/**/*"/>
                    <!-- excluding these -->
                    <exclude name="X3dExamplesX3dAdvancedModeling.zip"/>
                    <exclude name="X3dExamplesX3dForWebAuthors.zip"/>
                    <exclude name="X3dResources.html"/>
                    <exclude name="X3dSceneAuthoringHints.html"/>
                    <exclude name="indexSavage.redirect.html"/>
                    <exclude name="indexSavageDefense.redirect.html"/>
                    <exclude name="**/archive/*"/>
                    <exclude name="**/_archive/*"/>
                    <exclude name="_schematron/*"/>
                    <exclude name="**/_schematron/*"/>
                    <exclude name="**/_hide/*"/>
                    <exclude name="**/hide/*"/>
                    <exclude name="**/CVS/*"/>
                    <exclude name="**/.svn/*"/>
                    <exclude name="**/_new*.*"/>
                    <exclude name="**/*.bak"/>
                    <exclude name="**/Thumbs.db"/>
                    <exclude name="nbproject/"/>
                    <exclude name="**/nbproject"/>
                    <exclude name=".svn/"/>
                    <exclude name="**/.svn"/>
                    <exclude name="**/*.$$$"/>
                    <exclude name="**/*.\$\$\$"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.X3dForWebAuthors}/examples"/>
        <echo  message="sftp.uploadExampleUpdates.X3dForAdvancedModeling.scenes ssh-sftp task complete"/>
    </target>
    
    <target name="sftp.uploadExampleUpdates.X3dForAdvancedModeling.zip" depends="sftp.askUsernamePassword.X3dForAdvancedModeling"
        description="sftp upload of updated X3dForAdvancedModeling.zip archive">
        <echo  message="sftp upload to sftp://${sftpServer.X3dForWebAuthors}/${sftpDirectory.X3dForAdvancedModeling}/.."/>
        <ssh host="${sftpServer.X3dForWebAuthors}"
            username="${username.X3dForWebAuthors}"
            password="${password.X3dForWebAuthors}">
            <!-- top level:  latest copy of archive .zip -->
            <sftp action="put" verbose="true"
                newer="false" 
                skipfailedtransfers="false" 
                remotedir="${sftpDirectory.X3dForAdvancedModeling}/.." >
                <fileset dir=".">
                    <include name="X3dExamplesX3dAdvancedModeling.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.X3dForWebAuthors}/X3dExamplesX3dForWebAuthors.zip"/>
        <echo  message="sftp.uploadExampleUpdates.X3dForAdvancedModeling.zip ssh-sftp task complete"/>
    </target>

    <target name="sftp.uploadExampleUpdates.X3dForWebAuthors" depends="sftp.uploadExampleUpdates.X3dForWebAuthors.scenes,sftp.uploadExampleUpdates.X3dForWebAuthors.zip"
        description="sftp upload of updated X3D archive files, including .zip">
    </target>

    <target name="sftp.uploadExampleUpdates.X3dForWebAuthors.scenes" depends="sftp.askUsernamePassword.X3dForWebAuthors"
        description="sftp upload of updated X3D archive files, not including .zip">
        <echo  message="sftp upload to sftp://${sftpServer.X3dForWebAuthors}/${sftpDirectory.X3dForWebAuthors}"/>
        <ssh host="${sftpServer.X3dForWebAuthors}"
            username="${username.X3dForWebAuthors}"
            password="${password.X3dForWebAuthors}">
            <sftp action="put" verbose="true"
                newer="true" 
                skipfailedtransfers="true" 
                remotedir="${sftpDirectory.X3dForWebAuthors}" >
                <fileset refid="web3d.common.fileset"/>
                <fileset dir=".">
                    <!-- future book directories will immediately follow the next include entries -->
                    <include name="X3dForWebAuthors/*"/>
                    <include name="X3dForWebAuthors/**/*"/>
                    <!-- excluding these -->
                    <exclude name="X3dExamplesX3dAdvancedModeling.zip"/>
                    <exclude name="X3dExamplesX3dForWebAuthors.zip"/>
                    <exclude name="X3dResources.html"/>
                    <exclude name="X3dSceneAuthoringHints.html"/>
                    <exclude name="indexSavage.redirect.html"/>
                    <exclude name="indexSavageDefense.redirect.html"/>
                    <exclude name="**/archive/*"/>
                    <exclude name="**/_archive/*"/>
                    <exclude name="_schematron/*"/>
                    <exclude name="**/_schematron/*"/>
                    <exclude name="**/_hide/*"/>
                    <exclude name="**/hide/*"/>
                    <exclude name="**/CVS/*"/>
                    <exclude name="**/.svn/*"/>
                    <exclude name="**/_new*.*"/>
                    <exclude name="**/*.bak"/>
                    <exclude name="**/Thumbs.db"/>
                    <exclude name="nbproject/"/>
                    <exclude name="**/nbproject"/>
                    <exclude name=".svn/"/>
                    <exclude name="**/.svn"/>
                    <exclude name="**/*.$$$"/>
                    <exclude name="**/*.\$\$\$"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.X3dForWebAuthors}/examples"/>
        <echo  message="sftp.uploadExampleUpdates.X3dForWebAuthors.scenes ssh-sftp task complete"/>
    </target>
    
    <target name="sftp.uploadExampleUpdates.X3dForWebAuthors.zip" depends="sftp.askUsernamePassword.X3dForWebAuthors"
        description="sftp upload of updated X3dForWebAuthors.zip archive">
        <echo  message="sftp upload to sftp://${sftpServer.X3dForWebAuthors}/${sftpDirectory.X3dForWebAuthors}/.."/>
        <ssh host="${sftpServer.X3dForWebAuthors}"
            username="${username.X3dForWebAuthors}"
            password="${password.X3dForWebAuthors}">
            <!-- top level:  latest copy of archive .zip -->
            <sftp action="put" verbose="true"
                newer="false" 
                skipfailedtransfers="false" 
                remotedir="${sftpDirectory.X3dForWebAuthors}/.." >
                <fileset dir=".">
                    <include name="X3dExamplesX3dForWebAuthors.zip"/>
                </fileset>
            </sftp>
        </ssh>
        <echo  message="upload available at http://${sftpServer.X3dForWebAuthors}/X3dExamplesX3dForWebAuthors.zip"/>
        <echo  message="sftp.uploadExampleUpdates.X3dForWebAuthors.zip ssh-sftp task complete"/>
    </target>
    
    <target name="sftp.cleanup.all" depends=""
        description="sftp cleanup of unwanted backup files in all X3D archives">
        <echo  message="sftp cleanup of unwanted backup files in X3D Example Archives on various servers"/>
        <antcall target="sftp.cleanup.X3dForAdvancedModeling"/>
        <antcall target="sftp.cleanup.X3dForWebAuthors"/>
        <antcall target="sftp.cleanup.web3d"/>
        <antcall target="sftp.cleanup.savage"/>
        <antcall target="sftp.cleanup.savageDefense"/>
    </target>
    
    <fileset dir="." id="backupFiles">
    <!--<include name="**/*Canonical.x3d"/> removed this line once clean -->
        <include name="**/_new_pretty_print.html"/>
        <include name="**/_new_result.wrl"/>
        <include name="**/_new_result.x3d"/>
        <include name="**/_new_result.x3dv"/>
        <include name="**/_new_result.x3db"/>
        <include name="**/_new_resultCanonical.xml"/>
        <include name="**/Thumb.db"/>
        <include name="**/*.bak"/>
        <include name="**/hs_err_pid*.log"/>
        <include name="**/manifest.mf"/>
        <include name="**/*.$$$$$$"/> <!-- escaped .$$$ -->
        <include name="**/archive"/>
        <include name="**/_archive"/>
        <include name="**/_schematron"/>
        <include name="**/hide"/>
        <include name="**/_hide"/>
        <include name="Untitled-?.x3d"/>
        <include name="**/Untitled-?.x3d"/>
        <include name="nbproject"/>
        <include name="**/nbproject"/>
        <include name="CVS"/>
        <include name="**/CVS"/>
        <include name=".svn"/>
        <include name="**/.svn"/>
        <include name="**/*Canonical.x3d"/>
        <include name="**/*Canonical.x3db"/>
        <include name="**/*Canonical.x3dv"/>
        <include name="**/*Canonical.wrl"/>
        <include name="**/*Canonical.html"/>
    </fileset>
    
    <target name="sftp.cleanup.savage" depends="sftp.askUsernamePassword.savage"
        description="sftp cleanup of unwanted backup files in X3D archive">
        <echo  message="sftp cleanup of unwanted backup files in sftp://${sftpServer.savage}"/>
        <ssh host="${sftpServer.savage}"
            username="${username.savage}"
            password="${password.savage}">
            <!-- top level -->
            <sftp action="delete" verbose="true"
                remotedir="${sftpDirectory.savage}" >
                <fileset refid="backupFiles"/>
            </sftp>
        </ssh>
        <echo  message="sftp.cleanup.savage ssh-sftp task complete"/>
    </target>
    
    <target name="sftp.cleanup.savageDefense" depends="sftp.askUsernamePassword.savageDefense"
        description="sftp cleanup of unwanted backup files in X3D archive">
        <echo  message="sftp cleanup of unwanted backup files in sftp://${sftpServer.savageDefense}"/>
        <ssh host="${sftpServer.savageDefense}"
            username="${username.savageDefense}"
            password="${password.savageDefense}">
            <!-- top level -->
            <sftp action="delete" verbose="true"
                remotedir="${sftpDirectory.savageDefense}" >
                <fileset refid="backupFiles"/>
            </sftp>
        </ssh>
        <echo  message="sftp.cleanup.savageDefense ssh-sftp task complete"/>
    </target>
    
    <target name="sftp.cleanup.web3d" depends="sftp.askUsernamePassword.web3d"
        description="sftp cleanup of unwanted backup files in X3D archive">
        <echo  message="sftp cleanup of unwanted backup files in sftp://${sftpServer.web3d}"/>
        <ssh host="${sftpServer.web3d}"
            username="${username.web3d}"
            password="${password.web3d}">
            <!-- top level -->
            <sftp action="delete" verbose="true"
                remotedir="${sftpDirectory.web3d}" >
                <fileset refid="backupFiles"/>
            </sftp>
        </ssh>
        <echo  message="sftp.cleanup.web3d ssh-sftp task complete"/>
    </target>
    
    <target name="sftp.cleanup.X3dForAdvancedModeling" depends="sftp.askUsernamePassword.X3dForAdvancedModeling"
        description="sftp cleanup of unwanted backup files in X3D archive">
        <echo  message="sftp cleanup of unwanted backup files in sftp://${sftpServer.web3d}"/>
        <ssh host="${sftpServer.X3dForWebAuthors}"
            username="${username.X3dForWebAuthors}"
            password="${password.X3dForWebAuthors}">
            <!-- top level -->
            <sftp action="delete" verbose="true"
                remotedir="${sftpDirectory.X3dForAdvancedModeling}" >
                <fileset refid="backupFiles"/>
            </sftp>
        </ssh>
        <echo  message="sftp.cleanup.web3d ssh-sftp task complete"/>
    </target>
    
    <target name="sftp.cleanup.X3dForWebAuthors" depends="sftp.askUsernamePassword.X3dForWebAuthors"
        description="sftp cleanup of unwanted backup files in X3D archive">
        <echo  message="sftp cleanup of unwanted backup files in sftp://${sftpServer.web3d}"/>
        <ssh host="${sftpServer.X3dForWebAuthors}"
            username="${username.X3dForWebAuthors}"
            password="${password.X3dForWebAuthors}">
            <!-- top level -->
            <sftp action="delete" verbose="true"
                remotedir="${sftpDirectory.X3dForWebAuthors}" >
                <fileset refid="backupFiles"/>
            </sftp>
        </ssh>
        <echo  message="sftp.cleanup.web3d ssh-sftp task complete"/>
    </target>

    <target name="hiddenArchiveDirectoryRename" depends="" description="ensure proper naming of hidden directories" >
        <move file="*/*/*/archive/*" todir="**/_archive" overwrite="true" failonerror="false" verbose="true"/>
    </target>
    
    <!-- TODO move this target task down into the relevant project subdirectory; let it run there while getting invoked from here -->
    <target name="convertCmlScenes" depends="" 
            description="convert XML-based molecule descriptions (protected in Basic examples archive subdirectory) from CML to X3D" >
        <echo message="clean conversion results..."/>
        <delete>
            <fileset dir="Basic/ChemicalMarkupLanguage" includes="*.x3d"/>
            <fileset dir="Basic/ChemicalMarkupLanguage" includes="*Canonical.xml"/>
        </delete>
        <echo message="validate stylesheet..."/>
        <xmlvalidate file="Basic/ChemicalMarkupLanguage/CmlToX3d.xslt" failonerror="true" warn="true" lenient="yes"/>
        <!-- TODO:  validation of .xml CML -->
        <echo message="validate CML .xml models..."/>
        <xmlvalidate failonerror="false" warn="true" lenient="yes">
            <fileset dir="Basic/ChemicalMarkupLanguage">
                <include name="*.xml"/>
            </fileset>
        </xmlvalidate>
        <echo message="convert CML models into X3D scenes..."/>
        <!-- When copied, CML filenames beginning with numeric characters were modified and given _ underscore prefix to permit validation of autogenerated IDs -->
        <xslt destdir="." style="Basic/ChemicalMarkupLanguage/CmlToX3d.xslt" force="true">
            <include name="Basic/ChemicalMarkupLanguage/*.xml"/>
            <mapper type="glob" from="*.xml" to="*.x3d"/>
            <xmlcatalog refid="X3dCatalog"/>
        </xslt>
        <echo message="validate X3D scenes..."/>
        <xmlvalidate failonerror="false" warn="true" lenient="yes">
            <fileset dir="Basic/ChemicalMarkupLanguage">
                <include name="*.x3d"/>
            </fileset>
            <xmlcatalog refid="X3dCatalog"/>
        </xmlvalidate>
    </target>

    <target name="validate.all" depends="" description="XML validation checks" >
        <!-- not clear whether this uses schema or DTD.  likely DTD. -->
        <xmlvalidate failonerror="false" warn="true">
            <fileset dir=".">
                <include name="*.xml"/>
                <!-- <include name="*.xsd"/> -->
                <exclude name="build*.xml"/>
            </fileset>
        </xmlvalidate>
        <xmlvalidate file="build.xml"                 failonerror="false" warn="true" lenient="yes"/>
        <xmlvalidate file="buildExamplesTemplate.xml" failonerror="false" warn="true" lenient="yes"/>
        <ant dir="Basic"              target="validate"/>
        <ant dir="ConformanceNist"    target="validate"/>
        <ant dir="Vrml2.0Sourcebook"  target="validate"/>
        <ant dir="Savage"             target="validate"/>
        <ant dir="SavageDefense"      target="validate"/>
        <ant dir="X3dForAdvancedModeling"   target="validate"/>
        <ant dir="X3dForWebAuthors"   target="validate"/>
    </target>

    <target name="validate.DTD" depends="" description="XML DTD validation checks" >
        <ant dir="Basic"              target="validate.DTD"/>
        <ant dir="ConformanceNist"    target="validate.DTD"/>
        <ant dir="Vrml2.0Sourcebook"  target="validate.DTD"/>
        <ant dir="Savage"             target="validate.DTD"/>
        <ant dir="SavageDefense"      target="validate.DTD"/>
        <ant dir="X3dForAdvancedModeling"   target="validate.DTD"/>
        <ant dir="X3dForWebAuthors"   target="validate.DTD"/>
    </target>

    <target name="validate.schematron" depends="" description="X3D Schematron rule checks" >
        <ant dir="Basic"              target="validate.schematron"/>
        <ant dir="ConformanceNist"    target="validate.schematron"/>
        <ant dir="Vrml2.0Sourcebook"  target="validate.schematron"/>
        <ant dir="Savage"             target="validate.schematron"/>
        <ant dir="SavageDefense"      target="validate.schematron"/>
        <ant dir="X3dForAdvancedModeling"   target="validate.schematron"/>
        <ant dir="X3dForWebAuthors"   target="validate.schematron"/>
    </target>
    
    <target name="renameCanonicalScenes.all" depends="" description="renameCanonicalScenes for each of the example archives" >
        <ant dir="Basic"              target="renameCanonicalScenes"/>
        <ant dir="ConformanceNist"    target="renameCanonicalScenes"/>
        <ant dir="Vrml2.0Sourcebook"  target="renameCanonicalScenes"/>
        <ant dir="Savage"             target="renameCanonicalScenes"/>
        <ant dir="SavageDefense"      target="renameCanonicalScenes"/>
        <ant dir="X3dForAdvancedModeling"   target="renameCanonicalScenes"/>
        <ant dir="X3dForWebAuthors"   target="renameCanonicalScenes"/>
    </target>

    <target name="zip.all" depends="" description="zip each of the example archives" >
        <ant dir="Basic"              target="zip"/>
        <ant dir="ConformanceNist"    target="zip"/>
        <ant dir="Vrml2.0Sourcebook"  target="zip"/>
        <ant dir="Savage"             target="zip"/>
        <ant dir="SavageDefense"      target="zip"/>
        <ant dir="X3dForAdvancedModeling"   target="zip"/>
        <ant dir="X3dForWebAuthors"   target="zip"/>
    </target>
    
    <target name="HelloWorldCopyToArchives" description="Copy HelloWorld.x3d example from common example archives to 2 archives for documentation" >
        <copy todir="Basic/development" preservelastmodified="false" verbose="true">
            <fileset dir="." includes="HelloWorld.x3d"/>
            <fileset dir="." includes="earth-topo*.*"/>
            <fileset dir="." includes="HelloWorld.Tall.png"/>
        </copy>
        <copy todir="X3dForWebAuthors/Chapter01-TechnicalOverview" preservelastmodified="false" verbose="true">
            <fileset dir="." includes="HelloWorld.x3d"/>
            <fileset dir="." includes="earth-topo*.*"/>
            <fileset dir="." includes="HelloWorld.Tall.png"/>
        </copy>
    </target>
    
</project>
