From 16b218444212664fb3d21bd2a19a129990f8dd0d Mon Sep 17 00:00:00 2001
From: Don Brutzman <brutzman@nps.edu>
Date: Tue, 13 Oct 2020 15:49:31 -0700
Subject: [PATCH] multiple refinements

---
 build.xml | 71 +++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 51 insertions(+), 20 deletions(-)

diff --git a/build.xml b/build.xml
index 6e66a4d09c..131026cc6b 100644
--- a/build.xml
+++ b/build.xml
@@ -153,6 +153,9 @@ POSSIBILITY OF SUCH DAMAGE.
     <property name="arq" location="${env.JENA_HOME}/bat/arq.bat" description="executable invocation, bat/arq.bat or bin/arq"/>
     <property name="semantics.dir" location="../../../../semantics"/>
     
+    <!--            xml.catalog.dir is found in ${X3dDtdsSchemas.dir} -->
+    <property name="xml.catalog.file" value="OasisXmlCatalogX3D.xml"/>
+    
     <!-- ======================================== -->
     <!-- Xj3D internal paths for finding OS-specific /natives files, adapted from from NPS-branch build_nps.xml and build.properties -->
 
@@ -320,16 +323,18 @@ Key references:
         <dtd    publicId="http://www.web3d.org/specifications/x3d-3.1.dtd"              location="${X3dDtdsSchemas.dir}/x3d-3.1.dtd"/>
         <dtd    publicId="http://www.web3d.org/specifications/x3d-3.2.dtd"              location="${X3dDtdsSchemas.dir}/x3d-3.2.dtd"/>
         <dtd    publicId="http://www.web3d.org/specifications/x3d-3.3.dtd"              location="${X3dDtdsSchemas.dir}/x3d-3.3.dtd"/>
+        <dtd    publicId="http://www.web3d.org/specifications/x3d-4.0.dtd"              location="${X3dDtdsSchemas.dir}/x3d-4.0.dtd"/>
         <entity publicId="http://www.web3d.org/specifications/x3d-3.0.xsd"              location="${X3dDtdsSchemas.dir}/x3d-3.0.xsd"/>
         <entity publicId="http://www.web3d.org/specifications/x3d-3.1.xsd"              location="${X3dDtdsSchemas.dir}/x3d-3.1.xsd"/>
         <entity publicId="http://www.web3d.org/specifications/x3d-3.2.xsd"              location="${X3dDtdsSchemas.dir}/x3d-3.2.xsd"/>
         <entity publicId="http://www.web3d.org/specifications/x3d-3.3.xsd"              location="${X3dDtdsSchemas.dir}/x3d-3.3.xsd"/>
+        <entity publicId="http://www.web3d.org/specifications/x3d-4.0.xsd"              location="${X3dDtdsSchemas.dir}/x3d-4.0.xsd"/>
         <!-- Transitional DTD, versions 3.0 and 3.1 only -->
         <dtd    publicId="file:///www.web3d.org/TaskGroups/x3d/translation/x3d-3.0.dtd" location="${X3dDtdsSchemas.dir}/x3d-3.0.dtd"/>
         <dtd    publicId="file:///www.web3d.org/TaskGroups/x3d/translation/x3d-3.1.dtd" location="${X3dDtdsSchemas.dir}/x3d-3.1.dtd"/>
         <!-- fallback solution, depends on resolver.jar availability -->
         <xmlcatalog>
-            <catalogpath location="${X3dDtdsSchemas.dir}/OasisXmlCatalogX3D.xml" description="external path to same definitions"/>
+            <catalogpath location="${X3dDtdsSchemas.dir}/${xml.catalog.file}" description="external path to same definitions"/>
         </xmlcatalog>
     </xmlcatalog>
 
@@ -350,13 +355,16 @@ Key references:
         <attribute name="parameterPair3" default=""/>
         <sequential>
             <!--
-            <echo message="Saxon9 processing @{scene}@{suffix}.@{extension} using @{stylesheet}, parameterPair0=@{parameterPair0}, parameterPair1=@{parameterPair1}"/>
+			<echo message="Saxon9 processing @{scene}@{suffix}.@{extension} using @{stylesheet}, -catalog:${X3dDtdsSchemas.dir}/${xml.catalog.file}"/>
+			<echo message="... -expand:'@{expand}' parameterPair1='@{parameterPair1}' parameterPair2='@{parameterPair2}' parameterPair3='@{parameterPair3}'"/>
             -->
 			<java classname="net.sf.saxon.Transform"
 				  classpath="${saxon.dir}/${saxon.jar};${resolver.dir}/resolver.jar"
 				  fork="${fork}"
 				  failonerror="false">
 				<!-- TODO
+                https://stackoverflow.com/questions/14165765/how-to-use-saxon-built-in-catalog-feature
+                
 				<jvmarg value="-Dxml.catalog.files=C:/www.web3d.org/specifications/OasisXmlCatalogX3D.xml"/>
 				<jvmarg value="-Dxml.catalog.verbosity=4"/>
 				use the Apache commons resolver for XML Catalog resolution of online DTD, schema addresses
@@ -376,8 +384,9 @@ Key references:
 				<arg value="-s:@{scene}.x3d"/>                  <!--  input file -->
 				<arg value="-o:@{scene}@{suffix}.@{extension}"/><!-- output file -->
 				<arg value="-xsl:@{stylesheet}.xslt"/>  <!-- regular stylesheet -->
-				<arg value="-dtd:off"/>                 <!-- suppress creation of default DTD values, only use values in document -->
+				<arg value="-dtd:off"/>                 <!-- DTD validation (on|off|recover); suppress creation of default DTD values, only use values in document -->
 				<arg value="-expand:@{expand}"/>        <!-- whether to expand (i.e. add) DTD default values (on|off) -->
+                <arg value="-catalog:${X3dDtdsSchemas.dir}/${xml.catalog.file}"/> 
 				<arg value="@{parameterPair1}"/>        <!-- parameter=value passed to stylesheet -->
 				<arg value="@{parameterPair2}"/>
 				<arg value="@{parameterPair3}"/>
@@ -1545,7 +1554,7 @@ ignoreSetupDownloadErrors=true
     </target>
 
     <target name="copy.X3DJSAIL.update.local" description="get latest X3DJSAIL update" >
-        <echo message="get latest X3DJSAIL update from https://www.web3d.org/specifications/java/X3DJSAIL.html"/>
+        <echo message="get latest X3DJSAIL update from ${x3djsail.stylesheets.dir}"/>
         <copy file="${x3djsail.stylesheets.dir}/${jsai.full.archive.jar.name}"
              todir="lib/" verbose="true"/>
         <length property="jsai.full.archive.jar.length" file="lib/${jsai.full.archive.jar.name}"/>
@@ -2304,8 +2313,8 @@ ignoreSetupDownloadErrors=true
         <antcall target="processScenes.X3dToX3domXhtml"/>
         <antcall target="processScenes.X3dToX3dvClassicVrmlEncoding"/>
         <antcall target="processScenes.X3dToX3dbCompressedBinaryEncoding"/>
-        <!-- processScenes.captureImages need to precede processScenes.htmlPrettyPrintPages -->
-        <antcall target="processScenes.captureImages"/>
+        <!-- processScenes.captureImages need to precede processScenes.htmlPrettyPrintPages
+        <antcall target="processScenes.captureImages"/> -->
         <antcall target="processScenes.htmlPrettyPrintPages"/>
         <echo message="${archive.name} processScenes complete."/>
     </target>
@@ -2359,7 +2368,6 @@ ignoreSetupDownloadErrors=true
                         parameterPair1="linkImages=true"
 				expand="on"/>
 			<!-- expand:on since DTD defaults needed -->
-                        <!-- TODO -dtd:off -->
                         <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d processing with X3dExtrusionCrossSectionToSvg stylesheet for SVG diagrams (if Extrusion found)</echo>
                         <!-- Saxon9 is locally defined macro -->
                         <Saxon9  scene="${relative.path1}/${relative.path2}/${name.short}"
@@ -2420,7 +2428,8 @@ ignoreSetupDownloadErrors=true
                     <mapper dir="." type="glob" from="*.x3d" to="*X3dom.xhtml"/>
                     <sequential>
                         <!-- process individual files here. show full path to facilitate user loading, editing of reported files -->
-                        <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d processing with X3dToX3dom stylesheet: ${name.short}X3dom.xhtml</echo>
+                        <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d processing with X3dToX3dom stylesheet:</echo>
+                        <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}X3dom.xhtml</echo>
                         <!-- Saxon9 is locally defined macro -->
                         <Saxon9  scene="${relative.path1}/${relative.path2}/${name.short}"
                             stylesheet="${stylesheet.dir}/X3dToX3dom"
@@ -2429,7 +2438,6 @@ ignoreSetupDownloadErrors=true
                              extension="xhtml"
 				expand="on"/>
 			<!-- expand:on since DTD defaults needed -->
-                        <!-- TODO -dtd:off -->
                     </sequential>
                 </outofdate>
             </sequential>
@@ -2493,7 +2501,6 @@ ignoreSetupDownloadErrors=true
                              extension="html"
 				expand="on"/>
 			<!-- expand:on since DTD defaults needed -->
-                        <!-- TODO -dtd:off -->
                     </sequential>
                 </outofdate>
             </sequential>
@@ -2627,6 +2634,9 @@ ignoreSetupDownloadErrors=true
                     </elseif>
                     <elseif>
                         <and>
+                            <not>
+                                <contains string="@{file.path.name}" substring="javadoc" />
+                            </not>
                             <not>
                                 <contains string="@{file.path.name}" substring="mootool" />
                             </not>
@@ -2642,15 +2652,18 @@ ignoreSetupDownloadErrors=true
                 </if>
                 <if>
                     <and>
-                        <not>
-                            <contains string="@{file.path.name}" substring="mootool" />
-                        </not>
-                        <not>
-                            <contains string="@{file.path.name}" substring="slideshow." />
-                        </not>
-                        <not>
-                            <equals arg1="@{file.path.name}" arg2=""/>
-                        </not>
+                            <not>
+                                <contains string="@{file.path.name}" substring="javadoc" />
+                            </not>
+                            <not>
+                                <contains string="@{file.path.name}" substring="mootool" />
+                            </not>
+                            <not>
+                                <contains string="@{file.path.name}" substring="slideshow." />
+                            </not>
+                            <not>
+                                <equals arg1="@{file.path.name}" arg2=""/>
+                            </not>
                     </and>
                     <then>
                         <echo>jslint  @{file.path.name}</echo>
@@ -3307,7 +3320,6 @@ app.replica.args=-mode scene -mipmaps -antialias 8 -anisotropicDegree 16 -verbos
                             stylesheet="${stylesheet.dir}/X3dToXhtml"
                              extension="html"
                         parameterPair1="linkImages=true"/>
-                        <!-- TODO -dtd:off -->
                     </sequential>
                 </outofdate>
             </sequential>
@@ -3925,12 +3937,31 @@ app.replica.args=-mode scene -mipmaps -antialias 8 -anisotropicDegree 16 -verbos
                         <schemavalidate file="${relative.path1}/${relative.path2}/${name.short}.x3d" failonerror="false" fullchecking="false" lenient="false" warn="true">
                             <xmlcatalog refid="X3dCatalog"/>
                         </schemavalidate>
+                        <!-- from processScenes.htmlPrettyPrintPages -->
+                        <!-- process individual files here. show full path to facilitate user loading, editing of reported files -->
+                        <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d processing with X3dToXhtml stylesheet for pretty-print .html</echo>
+                        <!-- Saxon9 is locally defined macro -->
+                        <Saxon9  scene="${relative.path1}/${relative.path2}/${name.short}"
+                            stylesheet="${stylesheet.dir}/X3dToXhtml"
+                             extension="html"
+                        parameterPair1="linkImages=true"
+				expand="on"/>
+			<!-- expand:on since DTD defaults needed -->
+                        <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d processing with X3dExtrusionCrossSectionToSvg stylesheet for SVG diagrams (if Extrusion found)</echo>
+                        <!-- Saxon9 is locally defined macro -->
+                        <Saxon9  scene="${relative.path1}/${relative.path2}/${name.short}"
+                            stylesheet="${stylesheet.dir}/X3dExtrusionCrossSectionToSvg"
+                             extension="svg"
+                                expand="on"/>
+                        <!-- expand:on since DTD defaults needed -->
                     </sequential>
                 </outofdate>
             </sequential>
         </for>
         <antcall target="echo.timestamp"/>
         <echo>processScenes.X3dTidy complete.</echo>
+        <echo>==================================================</echo>
+        <echo>==================================================</echo>
     </target>
 
     <target  name="clean.java">
-- 
GitLab