ODFTOOLKIT-437 validator: add -m flag for MathML schema
It turns out that the flags that were added in
cebaca9f710a9a06e177c6e80eb87d9e5c6c8c0c are not enough:
If the package contains a MathML embedded object, a null pointer
exception occurs, because the ODFValidator class assumes that either
all schemas are passed into its constructor as a Configuration,
or none of them are.
-M would be more appropriate, but it's already used, so use -m.
diff --git a/validator/src/main/java/org/odftoolkit/odfvalidator/Main.java b/validator/src/main/java/org/odftoolkit/odfvalidator/Main.java
index bffeb1e..e92354f 100644
--- a/validator/src/main/java/org/odftoolkit/odfvalidator/Main.java
+++ b/validator/src/main/java/org/odftoolkit/odfvalidator/Main.java
@@ -55,6 +55,7 @@
String aSchemaFileName = null;
String aManifestSchemaFileName = null;
String aDSigSchemaFileName = null;
+ String aMathMLSchemaFileName = null;
String aOutputFileName = null;
String aExcludeRegExp = null;
boolean bPrintGenerator = false;
@@ -165,6 +166,13 @@
else
bCommandLineValid = false;
}
+ else if( aArg.equals("-m") )
+ {
+ if( aArgIter.hasNext() )
+ aMathMLSchemaFileName = aArgIter.next();
+ else
+ bCommandLineValid = false;
+ }
else if( aArg.equals("-V") )
{
bPrintVersion = true;
@@ -267,7 +275,8 @@
&& ( aStrictSchemaFileName != null
|| aSchemaFileName != null
|| aManifestSchemaFileName != null
- || aDSigSchemaFileName != null))
+ || aDSigSchemaFileName != null
+ || aMathMLSchemaFileName != null))
{
aConfig = new Configuration();
}
@@ -288,6 +297,10 @@
{
aConfig.setProperty( Configuration.DSIG_SCHEMA, aDSigSchemaFileName );
}
+ if (aMathMLSchemaFileName != null)
+ {
+ aConfig.setProperty(Configuration.MATHML2_SCHEMA, aMathMLSchemaFileName);
+ }
PrintStream aOut = aOutputFileName != null ? new PrintStream( aOutputFileName ) : System.out;
ODFValidator aValidator = new ODFValidator( aConfig, nLogLevel, aVersion, bUseMathDTD );
@@ -320,6 +333,7 @@
System.out.println( "usage: odfvalidator -g <odffiles>");
System.out.println( " odfvalidator [-r] [-c|-e|-s] [-d] [-v|-w] [-f <filterfile>] [-x <regexp>] [-o outputfile] [-1.0|-1.1|-1.2] <odffiles>");
System.out.println( " odfvalidator [-r] [-c|-e|-s] [-d] [-v|-w] [-f <filterfile>] [-x <regexp>] [-o outputfile] -S <schemafile> <odffiles>");
+ System.out.println( " odfvalidator [-r] [-c|-e|-s] [-v|-w] -O <rngfile> -M <rngfile> -D <rngfile> -m <xsdfile> [-f <filterfile>] [-x <regexp>] [-o outputfile] <odffiles>");
System.out.println( " odfvalidator [-c|-s] [-v|-w] [-d] [-o outputfile] -C <configfile>");
System.out.println( " odfvalidator -h");
System.out.println( " odfvalidator -V");
@@ -329,6 +343,7 @@
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( "-m: Use MathML2 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)" );