The example code shown in the article is taken from a set of example programs downloadable from this page. There's one program for each of the document models used, with a common base class that provides a test driver. This test driver calls the document model specific code once for each document passed as a command line parameter, and prints some summary information for each document processed (allowing easy verification that the code is working properly).
The test driver also saves the text output generated by the processing. This goes to an "out.txt" file within the current directory for the test execution. If multiple files are passed as command line parameters this file will be overwritten, so that the end result will be the output for the last file processed.
One sample test data file is
included in the downloads, the "soap1.xml" file. This file includes several namespace
variations to check for proper handling by the example code. All the supplied code samples
handled this properly except for JDOM, which appeared to have an output problem with the
SOAP-ENV:Envelope element -- the generated output does not include
the namespace for this attribute.
The example programs are available here in two forms. Downloading the example jar gives source code, class files, compile and execute scripts, and the "soap1.xml" test data file -- just extract the files using the "jar" program included in the JDK. In order to actually run the samples you'll need to also have the jar files for the document models you're interested in along with any supporting libraries.
The full jar adds a "lib" subdirectory containing the versions of the document model jars used for developing and testing the example programs. This includes the Electric XML jar file, so you'll need to agree to the terms of the license for that product as it applies to the exml.jar file included in the distribution. This license applies only to that particular file, and you can void the license by deleting the file from your system after downloading and unpacking the distribution jar.
The "run.sh" script shows the classpath used for running the examples. It requires the name of the example program ("Crimson", "Dom4J", "EXml", "JDom", "Xerces", or "Xpp") to run as the first parameter, along with one or more test file names as additional parameters.
|Terms and Conditions for Electric XML|
Please read this license agreement carefully. Your use of Electric XML or any related documentation indicates your acceptance of the following terms and conditions. If you do not agree to these terms and conditions, you may not install or use Electric XML.
1. Ownership and License.
Electric XML is owned by The Mind Electric and is copyrighted and licensed, not sold. The Mind Electric grants you a non-exclusive, non-transferable license to use, modify and distribute Electric XML in both binary and source form as long as all of the following conditions are met:
If you cannot meet all of these conditions, please contact us to arrange a special custom license.
2. Term and Termination
This Agreement is effective until terminated. You may terminate this Agreement at any time by destroying all copies of Electric XML. This Agreement will terminate immediately without notice from The Mind Electric if you fail to comply with any provision of this Agreement. Upon termination, you must destroy all copies of Electric XML.
3. Warranty Disclaimer and Limitation of Liability
The Mind Electric licenses the Software to you on an "as is" basis, without warranty of any kind. The Mind Electric hereby expressly disclaims all warranties or conditions, either express or implied, including, but not limited to, the implied warranties or conditions of merchantability and fitness for a particular purpose. You are solely responsible for determining the appropriateness of using Electic XML and assume all risks associated with the use of it, including but not limited to the risks of program errors, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. Some jurisdictions do not allow for the exclusion or limitation of implied warranties, so the above limitations or exclusions may not apply to you.
The Mind Electric will not be liable for any direct damages or for any special, incidental, or indirect damages or for any economic consequential damages (including lost profits or savings), even if The Mind Electric has been advised of the possibility of such damages. The Mind Electric will not be liable for the loss of, or damage to, your records or data, or any damages claimed by you based on a third party claim. Some jurisdictions do not allow for the exclusion or limitation of incidental or consequential damages, so the above limitations or exclusions may not apply to you.
This Agreement is governed by the laws of the State of Texas. This Agreement is the only understanding and agreement we have regarding your use of Electric XML. It supersedes all other communications, understandings or agreements we may have had prior to this Agreement.