#ODFTOOLKIT-437# ODFValidator: make schema files configurable from cmd line, by Thorsten Behrens
Signed-off-by: Svante Schubert <svanteschubert@apache.org>
git-svn-id: https://svn.apache.org/repos/asf/incubator/odf/trunk@1759341 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/validator/src/main/java/org/odftoolkit/odfvalidator/Main.java b/validator/src/main/java/org/odftoolkit/odfvalidator/Main.java
index 7a6d5c2..23b142f 100644
--- a/validator/src/main/java/org/odftoolkit/odfvalidator/Main.java
+++ b/validator/src/main/java/org/odftoolkit/odfvalidator/Main.java
@@ -51,7 +51,10 @@
String aConfigFileName = null;
String aFilterFileName = null;
+ String aStrictSchemaFileName = null;
String aSchemaFileName = null;
+ String aManifestSchemaFileName = null;
+ String aDSigSchemaFileName = null;
String aOutputFileName = null;
String aExcludeRegExp = null;
boolean bPrintGenerator = false;
@@ -137,10 +140,31 @@
else if( aArg.equals("-S") )
{
if( aArgIter.hasNext() )
+ aStrictSchemaFileName = aArgIter.next();
+ else
+ bCommandLineValid = false;
+ }
+ else if( aArg.equals("-O") )
+ {
+ if( aArgIter.hasNext() )
aSchemaFileName = aArgIter.next();
else
bCommandLineValid = false;
}
+ else if( aArg.equals("-M") )
+ {
+ if( aArgIter.hasNext() )
+ aManifestSchemaFileName = aArgIter.next();
+ else
+ bCommandLineValid = false;
+ }
+ else if( aArg.equals("-D") )
+ {
+ if( aArgIter.hasNext() )
+ aDSigSchemaFileName = aArgIter.next();
+ else
+ bCommandLineValid = false;
+ }
else if( aArg.equals("-V") )
{
bPrintVersion = true;
@@ -236,10 +260,26 @@
}
}
- if( aSchemaFileName != null )
+ if( aConfig == null )
{
aConfig = new Configuration();
- aConfig.setProperty( Configuration.STRICT_SCHEMA, aSchemaFileName );
+ }
+
+ if( aStrictSchemaFileName != null )
+ {
+ aConfig.setProperty( Configuration.STRICT_SCHEMA, aStrictSchemaFileName );
+ }
+ if( aSchemaFileName != null )
+ {
+ aConfig.setProperty( Configuration.SCHEMA, aSchemaFileName );
+ }
+ if( aManifestSchemaFileName != null )
+ {
+ aConfig.setProperty( Configuration.MANIFEST_SCHEMA, aManifestSchemaFileName );
+ }
+ if( aDSigSchemaFileName != null )
+ {
+ aConfig.setProperty( Configuration.DSIG_SCHEMA, aDSigSchemaFileName );
}
PrintStream aOut = aOutputFileName != null ? new PrintStream( aOutputFileName ) : System.out;
@@ -276,7 +316,10 @@
System.out.println( " odfvalidator -V");
System.out.println();
System.out.println( "-C: Validate using configuration file <configfile>" );
- System.out.println( "-S: Use schema <schemafile> for validation" );
+ System.out.println( "-S: Use strict ODF schema <schemafile> for validation" );
+ System.out.println( "-O: Use ODF schema <schemafile> for validation" );
+ System.out.println( "-M: Use ODF manifest schema <schemafile> for validation" );
+ System.out.println( "-D: Use ODF dsig schema <schemafile> for validation" );
System.out.println( "-V: Print version" );
System.out.println( "-c: Check conformance (default for ODF 1.2 documents)" );
System.out.println( "-e: Check extended conformance (ODF 1.2 documents only)" );