incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject [odftoolkit] 02/02: ODFTOOLKIT-437 validator: add -m flag for MathML schema
Date Fri, 22 Jun 2018 15:38:31 GMT
This is an automated email from the ASF dual-hosted git repository.

mst pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/odftoolkit.git

commit 971c54fd38a968f5860014b44301872706f9e540
Author: Michael Stahl <Michael.Stahl@cib.de>
AuthorDate: Fri Jun 22 17:17:20 2018 +0200

    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.
---
 .../src/main/java/org/odftoolkit/odfvalidator/Main.java | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

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 @@ public class Main {
         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 @@ public class Main {
                 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 @@ public class Main {
                 && (   aStrictSchemaFileName != null
                     || aSchemaFileName != null
                     || aManifestSchemaFileName != null
-                    || aDSigSchemaFileName != null))
+                    || aDSigSchemaFileName != null
+                    || aMathMLSchemaFileName != null))
             {
                 aConfig = new Configuration();
             }
@@ -288,6 +297,10 @@ public class Main {
             {
                 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 @@ public class Main {
         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 @@ public class Main {
         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)" );


Mime
View raw message