diff --git a/DFDL/build.tests.log.txt b/DFDL/build.tests.log.txt index d4648aa48c83d19d8bde6766b529bc5d992b8c56..6a8b0234e4d2acc53f19c4853d5be221c1a186a6 100644 --- a/DFDL/build.tests.log.txt +++ b/DFDL/build.tests.log.txt @@ -1,4 +1,32 @@ ant -f /Users/terry/javaapis/robodata/DFDL tests +daffodil.parse.examples.helloWorld: +xmlvalidate well-formed original schema examples/helloWorld/src/main/resources/helloWorld.dfdl.xsd +1 file(s) have been successfully validated. +schemavalidate original schema examples/helloWorld/src/main/resources/helloWorld.dfdl.xsd +... schemavalidate passed +daffodil parse csv +... (note that apache daffodil warnings about dfdl:encodingErrorPolicy can be ignored) +[info] Time (compiling): 1293ms +[info] Time (parsing): 67ms +============================================ +parsed result examples/helloWorld/helloWorld.parse.xml +<?xml version="1.0" encoding="UTF-8"?> +<tns:helloWorld xmlns:tns="http://example.com/dfdl/helloworld/"> + <word>Hello</word> + <word>world!</word> +</tns:helloWorld> +============================================ +Check well-formed result examples/helloWorld/helloWorld.parse.xml +1 file(s) have been successfully validated. +Check schema-valid result examples/helloWorld/helloWorld.parse.xml using original helloWorld.dfdl.xsd +/Users/terry/javaapis/robodata/DFDL/examples/helloWorld/helloWorld.parse.xml:2:65: cvc-elt.1.a: Cannot find the declaration of element 'tns:helloWorld'. +/Users/terry/javaapis/robodata/DFDL/examples/helloWorld/src/main/resources/helloWorld.dfdl.xsd:8:75: TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of 'http://example.com/dfdl/helloworld/'. +/Users/terry/javaapis/robodata/DFDL/examples/helloWorld/src/main/resources/helloWorld.dfdl.xsd:8:75: TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of 'http://example.com/dfdl/helloworld/'. +/Users/terry/javaapis/robodata/DFDL/examples/helloWorld/helloWorld.parse.xml is not a valid XML document +TODO validation errors seem due to insufficient XML generation by Apache Daffodil +Suggested namespace declaration additions: + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="csv.dfdl.xsd" daffodil.parse.examples.csv: xmlvalidate well-formed original schema examples/csv/src/main/resources/com/tresys/csv/xsd/csv.dfdl.xsd 1 file(s) have been successfully validated. @@ -6,8 +34,8 @@ schemavalidate original schema examples/csv/src/main/resources/com/tresys/csv/xs ... schemavalidate passed daffodil parse csv ... (note that apache daffodil warnings about dfdl:encodingErrorPolicy can be ignored) -[info] Time (compiling): 1458ms -[info] Time (parsing): 101ms +[info] Time (compiling): 1282ms +[info] Time (parsing): 90ms ============================================ original result examples/csv/src/test/resources/com/tresys/csv/infosets/simpleCSV.xml <?xml version="1.0" encoding="UTF-8"?> @@ -103,8 +131,8 @@ schemavalidate original schema examples/pcap/src/main/resources/com/tresys/pcap/ ... schemavalidate passed daffodil parse pcap ... (note that apache daffodil warnings about dfdl:encodingErrorPolicy can be ignored) -[info] Time (compiling): 2790ms -[info] Time (parsing): 250ms +[info] Time (compiling): 2567ms +[info] Time (parsing): 231ms ============================================ original result examples/pcap/src/test/resources/com/tresys/pcap/infosets/dns.pcap.xml <pcap:PCAP xmlns:pcap="urn:pcap:2.4"> @@ -5248,4 +5276,4 @@ Suggested namespace declaration additions: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="pcap.dfdl.xsd" tests: -BUILD SUCCESSFUL (total time: 38 seconds) +BUILD SUCCESSFUL (total time: 54 seconds) diff --git a/DFDL/build.xml b/DFDL/build.xml index 951833b2e28d3132fbdbaf910222c8ca4aa20723..a49d8b6ae869f5580f76bae98b8d06b868b77ad8 100644 --- a/DFDL/build.xml +++ b/DFDL/build.xml @@ -3,11 +3,58 @@ <description>Builds, tests, and runs the project Robodata transformation usings Daffodil (DFDL)</description> <property environment="env"/> + <property name="examples.hello.world.dir" value="examples/helloWorld"/> <property name="examples.csv.dir" value="examples/csv"/> <property name="examples.pcap.dir" value="examples/pcap"/> <!-- Daffodil CLI commands at: https://daffodil.apache.org/cli/ --> + <!-- Basic example, low level --> + <target name="daffodil.parse.examples.helloWorld" description="daffodil.apache.org hello world example"> + <echo message="xmlvalidate well-formed original schema ${examples.hello.world.dir}/src/main/resources/helloWorld.dfdl.xsd"/> + <xmlvalidate file="${examples.hello.world.dir}/src/main/resources/helloWorld.dfdl.xsd" failonerror="false" warn="true" lenient="true"/> + <!-- note that XSD schema validation using schemavalidate task requires special setup https://ant.apache.org/manual/Tasks/schemavalidate.html --> + <echo message="schemavalidate original schema ${examples.hello.world.dir}/src/main/resources/helloWorld.dfdl.xsd"/> + <schemavalidate file="${examples.hello.world.dir}/src/main/resources/helloWorld.dfdl.xsd" failonerror="true" warn="true" lenient="false" fullchecking="false"> + <schema namespace="http://www.w3.org/2001/XMLSchema" file="lib/validation/XMLSchema.xsd"/> + </schemavalidate> + <echo message="... schemavalidate passed"/> + <echo message="daffodil parse csv"/> + <echo message="... (note that apache daffodil warnings about dfdl:encodingErrorPolicy can be ignored)"/> + <exec executable="bin/daffodil" dir="." vmlauncher="false"> + <arg value="--verbose"/> + <arg value="parse"/> + <!-- Daffodil tunables to suppress warnings about dfdl:encodingErrorPolicy --> + <arg line="-T suppressSchemaDefinitionWarnings=encodingErrorPolicyError"/> + <arg value="--schema"/> + <arg value="${examples.hello.world.dir}/src/main/resources/helloWorld.dfdl.xsd"/> + <arg value="--output"/> + <arg value="${examples.hello.world.dir}/helloWorld.parse.xml"/> + <arg value="--validate"/> + <arg value="on"/> + <arg value="${examples.hello.world.dir}/src/main/resources/helloWorld.dat"/> + </exec> + <echo message="============================================"/> + <echo message="parsed result ${examples.hello.world.dir}/helloWorld.parse.xml"/> + <concat description="show file for build log"> + <filelist dir="${examples.hello.world.dir}" files="helloWorld.parse.xml"/> + </concat> + <echo message="============================================"/> + <echo message="Check well-formed result ${examples.hello.world.dir}/helloWorld.parse.xml"/> + <xmlvalidate file="${examples.hello.world.dir}/helloWorld.parse.xml" failonerror="false" warn="true" lenient="true"/> + <!-- note that XSD schema validation using schemavalidate task requires special setup https://ant.apache.org/manual/Tasks/schemavalidate.html --> + <echo message="Check schema-valid result ${examples.hello.world.dir}/helloWorld.parse.xml using original helloWorld.dfdl.xsd"/> + <!-- note failonerror="false" in order to reach follow-on TODO --> + <!-- TODO: Do we need the attrib noNamespaceFile? (tdn) --> + <schemavalidate file="${examples.hello.world.dir}/helloWorld.parse.xml" failonerror="false" warn="true" lenient="false" + disableDTD="true" fullchecking="true" noNamespaceFile="${examples.hello.world.dir}/src/main/resources/helloWorld.dfdl.xsd"/> + <echo message="TODO validation errors seem due to insufficient XML generation by Apache Daffodil"/> + <echo message="Suggested namespace declaration additions:"/> + <echo message=' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'/> + <echo message=' xsi:noNamespaceSchemaLocation="csv.dfdl.xsd"'/> + </target> + + <!-- Medium example, intermediate level --> <target name="daffodil.parse.examples.csv" description="daffodil.apache.org csv example"> <echo message="xmlvalidate well-formed original schema ${examples.csv.dir}/src/main/resources/com/tresys/csv/xsd/csv.dfdl.xsd"/> <xmlvalidate file="${examples.csv.dir}/src/main/resources/com/tresys/csv/xsd/csv.dfdl.xsd" failonerror="false" warn="true" lenient="true"/> @@ -57,6 +104,7 @@ <echo message=' xsi:noNamespaceSchemaLocation="csv.dfdl.xsd"'/> </target> + <!-- Advanced example, high level --> <target name="daffodil.parse.examples.pcap" description="daffodil.apache.org pcap example"> <echo message="xmlvalidate well-formed original schema ${examples.pcap.dir}/src/main/resources/com/tresys/pcap/xsd/pcap.dfdl.xsd"/> <xmlvalidate file="${examples.pcap.dir}/src/main/resources/com/tresys/pcap/xsd/pcap.dfdl.xsd" failonerror="false" warn="true" lenient="true"/> @@ -108,7 +156,7 @@ <!-- Add test targets to the "depends" attrib test.csv,test.pcap --> <target name="tests" - depends="daffodil.parse.examples.csv,daffodil.parse.examples.pcap" + depends="daffodil.parse.examples.helloWorld,daffodil.parse.examples.csv,daffodil.parse.examples.pcap" description="Tests for various input/output formats"/> <target name="view.apache.daffodil" description="view apache daffodil online site in web browser (Netbeans only)"> diff --git a/DFDL/examples/helloWorld/build.xml b/DFDL/examples/helloWorld/build.xml index d7d7f8e365c780b55b8ea6e4217e7b9243fb67f2..4d240c2443f817d9adc41d1490f250ab1ad90031 100644 --- a/DFDL/examples/helloWorld/build.xml +++ b/DFDL/examples/helloWorld/build.xml @@ -70,4 +70,9 @@ nbproject/build-impl.xml file. --> + + <target name="-post-clean"> + <delete file="helloWorld.parse.xml"/> + </target> + </project>