public class ValidateXMLFiles
extends java.lang.Object
Usage:
java edu.northwestern.at.morphadorner.tools.validatexmlfiles.ValidateXMLFiles [schemaURI] input1.xml input2.xml ...
| schemaURI | Optional URI for a Relax NG or W3C schema against which to validate subsequent files. The schemaURi is treated as a Relax NG schema if it ends in ".rng", and as a W3C schema if it ends in ".xsd". The schema is ignored if it ends in anything else. |
| input*.xml | input XML files to validate. At least one file must be specified. |
Checks that the specified XML files are valid XML. For XML files referencing a DTD, checks that the XML is valid in the context of the DTD. For XML files that do not specify a DTD, the XML is validated against the optional leading Relax NG or W3C schema. If a schema file is not specified, and the XML document does not specify a DTD, the file will generally be reported as invalid.
Note: Creates a SAX parser for each document (one at a time). This allows even large adorned files to be validated.
| Modifier and Type | Field and Description |
|---|---|
protected static ValidationErrorHandler |
errorHandler
Validation error handler.
|
protected static javax.xml.validation.Schema |
schema
Holds compiled schema.
|
protected static javax.xml.validation.Validator |
validator
Schema validator.
|
| Constructor and Description |
|---|
ValidateXMLFiles() |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
initialize(java.lang.String[] args)
Initialize.
|
static void |
main(java.lang.String[] args)
Main program.
|
protected static int |
processFiles(java.lang.String[] args)
Process files.
|
protected static void |
processOneFile(java.lang.String xmlFileName)
Process one file.
|
protected static void |
terminate(int filesProcessed,
long processingTime)
Terminate.
|
protected static javax.xml.validation.Schema schema
protected static javax.xml.validation.Validator validator
protected static ValidationErrorHandler errorHandler
public static void main(java.lang.String[] args)
args - Program parameters.protected static boolean initialize(java.lang.String[] args)
protected static void processOneFile(java.lang.String xmlFileName)
xmlFileName - Input file name to check for Latin words.protected static int processFiles(java.lang.String[] args)
protected static void terminate(int filesProcessed,
long processingTime)
filesProcessed - Number of files processed.processingTime - Processing time in seconds.