The contained implementation of X3D Canonicalization (C14N) branches off from the Apache Software Foundataion (ASF) XML Security project that implements the World Wide Web Consortium (W3C) rules for Canonical XML.
The reason for this is due to some rules that must be overridden when canonicalizing X3D scene files. These overriding rules are detailed in the X3D Compressed Binary encoding specification for X3D Canonical Form. An X3D file needs to be in canonical form to markedly enhance security, encryption, compression and parsing of the scene file.
This is a work in progress. The following specifications have been implemented thus far:
The following X3D CBE rules have yet to be implemented:
This application contains a custom Ant task (X3dCanonicalizerAntTask) to parse and gather .x3d file information from a root directory (i.e. /www.web3d.org/x3d/content/examples). The custom task then passes absolute path references to the X3dDtdChecker. After DTD validation the X3dCanonicalizer is then invoked to process each *.x3d file found while traversing the appointed directory. The X3dCanonicalizer then places the results in the same directory as either *Canonical.xml or *Canonical.x3d. Optional input and C14N output Schema validation is supported. XMLUnit testing will then execute, if desired, to compare the XML only document structure differences between the original and C14N (control and test) scenes. In other words, whitespace, comments, attribute order, the number of attributes in an element, differences between text and CDATA, and element and text values are ignored.
The API for X3D Tools can be viewed here.
This application can be invoked via the 1.7.0, or greater version,
Apache Ant from the command line. It
should run seemlessly on any platform that has at least the J2SE 5.0
Virtual Machine installed, or from a preferred Integrated
Developer Environment (IDE) for the Java™ programming
language. A build.properties
file in the base directory can be
modified for Operating System (OS) specific properties.
Single file processing can be accomplished as well as multiple directory scene processing. Typing
ant help
on the command line, or examining the build.xml file will reveal the specific target to invoke for either of these operations.
External invocation from the command line is also supported if working outside of Apache Ant, or an IDE. Navigate to the distribution directory (dist). For the X3dDtdChecker type:
java -cp lib/X3dC14n.jar org.web3d.x3d.tools.X3dDtdChecker [-f | -t] [optional -v] <path>/SceneName.x3dFor the X3dCanonicalizer type:
java -jar lib/X3dC14n.jar [optional -v] <path>/SceneName.x3d or java -jar lib/X3dC14n.jar [optional -v] <path>/SceneName.x3d <path>/SceneNameCanonical.xml
Open Source license for this software can be viewed here.
Please review the application directory for its contents, the documentation (doc) folder and source code. Feel free to email Terry Norbraten, Don McGregor or Don Brutzman if you have any questions.
Updated 17 July 2007