incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From devin...@apache.org
Subject svn commit: r1172432 - /incubator/odf/trunk/validator/src/odfvalidator/
Date Mon, 19 Sep 2011 05:31:15 GMT
Author: devinhan
Date: Mon Sep 19 05:31:15 2011
New Revision: 1172432

URL: http://svn.apache.org/viewvc?rev=1172432&view=rev
Log:
changeset:   2:18a3a4dba190
user:        Michael Brauer
date:        Wed May 06 14:40:18 2009 +0200
Adapted to new ODF 1.2 conformance classes:
- New switch -e for extended conformance
- Check for correct root elements

Modified:
    incubator/odf/trunk/validator/src/odfvalidator/AlienFilter.java
    incubator/odf/trunk/validator/src/odfvalidator/ContentFilter.java
    incubator/odf/trunk/validator/src/odfvalidator/Main.java
    incubator/odf/trunk/validator/src/odfvalidator/MathML20Filter.java
    incubator/odf/trunk/validator/src/odfvalidator/MetaFilter.java
    incubator/odf/trunk/validator/src/odfvalidator/ODFFileValidator.java
    incubator/odf/trunk/validator/src/odfvalidator/ODFPackageValidator.java
    incubator/odf/trunk/validator/src/odfvalidator/ODFRootPackageValidator.java
    incubator/odf/trunk/validator/src/odfvalidator/ODFStreamValidator.java
    incubator/odf/trunk/validator/src/odfvalidator/ODFSubPackageValidator.java
    incubator/odf/trunk/validator/src/odfvalidator/ODFValidator.java

Modified: incubator/odf/trunk/validator/src/odfvalidator/AlienFilter.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/AlienFilter.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/AlienFilter.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/AlienFilter.java Mon Sep 19 05:31:15 2011
@@ -43,7 +43,7 @@ class AlienFilter extends XMLFilterImpl 
     private Logger m_aLogger;
 
     /** Creates a new instance of NamespaceFilter */
-    AlienFilter( Logger aLogger ) {
+    AlienFilter( Logger aLogger, String aVersion ) {
         m_aLogger = aLogger;
         m_aAlienElements = new Vector<Boolean>();
         
@@ -63,10 +63,16 @@ class AlienFilter extends XMLFilterImpl 
         m_aODFNamespaceSet.add( OdfNamespace.FORM.toString() );
         m_aODFNamespaceSet.add( OdfNamespace.PRESENTATION.toString() );
         m_aODFNamespaceSet.add( OdfNamespace.SMIL.toString() );
-        m_aODFNamespaceSet.add( "urn:oasis:names:tc:opendocument:xmlns:config:1.0" );
+        m_aODFNamespaceSet.add( OdfNamespace.CONFIG.toString() );
         m_aODFNamespaceSet.add( OdfNamespace.SCRIPT.toString() );
         m_aODFNamespaceSet.add( OdfNamespace.XLINK.toString() );
         m_aODFNamespaceSet.add( OdfNamespace.XFORMS.toString() );
+        if( aVersion.equals("1.2"))
+        {
+            m_aODFNamespaceSet.add( "http://www.w3.org/1999/xhtml" );
+            m_aODFNamespaceSet.add( "http://www.w3.org/2003/g/data-view#" );
+        }
+
     }
 
 
@@ -127,6 +133,7 @@ class AlienFilter extends XMLFilterImpl 
         return !m_aODFNamespaceSet.contains(aUri);
     }
 
+    @Override
     public void characters(char[] aChars, int nStart, int nLength) throws SAXException {
         boolean bProcessContent = m_aAlienElements.isEmpty() ? true : m_aAlienElements.lastElement();
         if( bProcessContent )

Modified: incubator/odf/trunk/validator/src/odfvalidator/ContentFilter.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/ContentFilter.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/ContentFilter.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/ContentFilter.java Mon Sep 19 05:31:15
2011
@@ -48,10 +48,13 @@ class ContentFilter extends NamespaceFil
     private static final int MAX_POINTS_LEN = 2048;
         
     private Logger m_aLogger;
+    private String m_aLocalElementName;
+    private boolean m_bRoot = true;
     
     /** Creates a new instance of KnownIssueFilter */
-    ContentFilter( Logger aLogger ) {
+    ContentFilter( Logger aLogger, String aLocalElementName ) {
         m_aLogger = aLogger;
+        m_aLocalElementName = aLocalElementName;
     }
 
     String adaptNamespaceUri( String aUri, String aPrefix)
@@ -98,6 +101,12 @@ class ContentFilter extends NamespaceFil
             }
         }
         super.startElement(aUri, aLocalName, aQName, aAtts);
+        if( m_bRoot )
+        {
+            if( !(aUri.equals(OFFICE_NAMESPACE_URI) && aLocalName.equals(m_aLocalElementName))
)
+                m_aLogger.logError("Invalid root element: " + aQName );
+            m_bRoot = false;
+        }
     }
 
 }

Modified: incubator/odf/trunk/validator/src/odfvalidator/Main.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/Main.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/Main.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/Main.java Mon Sep 19 05:31:15 2011
@@ -38,7 +38,7 @@ import java.util.Vector;
  */
 public class Main {
 
-    private static final String VERSION="1.1.1";
+    private static final String VERSION="1.1.2";
     
     /** Creates a new instance of Main */
     public Main() {
@@ -78,6 +78,10 @@ public class Main {
             {
                 bUseMathDTD = true;
             }
+            else if( aArg.equals("-e") )
+            {
+                nMode = ODFPackageValidator.CHECK_EXTENDED_CONFORMANCE;
+            }
             else if( aArg.equals("-f") )
             {
                 if( aArgIter.hasNext() )
@@ -151,7 +155,7 @@ public class Main {
                 System.out.println(": unknown option, use '-' for help");
                 return;
             }
-            else
+            else if( aArg.length()>0 )
             {
                 aFileNames.add( aArg );
             }
@@ -257,8 +261,8 @@ public class Main {
     private static void printUsage()
     {
         System.out.println( "usage: odfvalidator -g <odffiles>");
-        System.out.println( "       odfvalidator [-r] [-c|-s] [-d] [-v|-w] [-f <filterfile>]
[-x <regexp>] [-o outputfile] [-1.0|-1.1|-1.2] <odffiles>");
-        System.out.println( "       odfvalidator [-r] [-c|-s] [-d] [-v|-w] [-f <filterfile>]
[-x <regexp>] [-o outputfile] -S <schemafile> <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 [-c|-s] [-v|-w] [-d] [-o outputfile] -C
<configfile>");
         System.out.println( "       odfvalidator -h");
         System.out.println( "       odfvalidator -V");
@@ -266,14 +270,15 @@ public class Main {
         System.out.println( "-C: Validate using configuration file <configfile>" );
         System.out.println( "-S: Use schema <schemafile> for validation" );
         System.out.println( "-V: Print version" );
-        System.out.println( "-c: Check conformance" );
+        System.out.println( "-c: Check conformance (default for ODF 1.2 documents)" );
+        System.out.println( "-c: Check extended conformance (ODF 1.2 documents only)" );
         System.out.println( "-d: Use MathML DTD rather than MathML2 schema for validation"
);
         System.out.println( "-f: Use filterfile <filterfile>" );
         System.out.println( "-g: Show <odffiles> generators and exit" );
         System.out.println( "-h: Print this help and exit" );
         System.out.println( "-o: Store validation errors in <outputfile>" );
         System.out.println( "-r: Process directory recursivly" );
-        System.out.println( "-s: Validate against strict schema" );
+        System.out.println( "-s: Validate against strict schema (ODF 1.2 documents only)"
);
         System.out.println( "-v: Verbose output, including generator and warnings" );
         System.out.println( "-w: Print warnings" );
         System.out.println( "-x: Exclude paths that match <regexp>" );

Modified: incubator/odf/trunk/validator/src/odfvalidator/MathML20Filter.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/MathML20Filter.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/MathML20Filter.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/MathML20Filter.java Mon Sep 19 05:31:15
2011
@@ -40,6 +40,7 @@ class MathML20Filter extends XMLFilterIm
         m_aLogger = aLogger;
     }
 
+    @Override
     public InputSource resolveEntity(String aPublicId, String aSystemId) throws SAXException,
IOException {
         // Ignore the external OOo MathML DTD
         

Modified: incubator/odf/trunk/validator/src/odfvalidator/MetaFilter.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/MetaFilter.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/MetaFilter.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/MetaFilter.java Mon Sep 19 05:31:15 2011
@@ -31,9 +31,12 @@ class MetaFilter extends XMLFilterImpl {
 
     private boolean m_bInGenerator = false;
     private String m_aGenerator = "";
+    private boolean m_bRoot = true;
     
     private static final String META_NAMESPACE_URI = OdfNamespace.META.toString();
+    private static final String OFFICE_NAMESPACE_URI = OdfNamespace.OFFICE.toString();
     private static final String GENERATOR = "generator";
+    private static final String DOCUMENT_META = "document-meta";
 
     private Logger m_aLogger;
     private MetaInformationListener m_aMetaListener;
@@ -45,6 +48,7 @@ class MetaFilter extends XMLFilterImpl {
         m_aMetaListener = aMetaListener;
     }
     
+    @Override
     public void characters(char[] aChars, int nStart, int nLength) throws SAXException {
         super.characters(aChars, nStart, nLength);
         
@@ -54,6 +58,7 @@ class MetaFilter extends XMLFilterImpl {
         }
     }
 
+    @Override
     public void endElement(String aUri, String aLocalName, String aQName) throws SAXException
{
         super.endElement(aUri, aLocalName, aQName);
         
@@ -68,8 +73,16 @@ class MetaFilter extends XMLFilterImpl {
         }
     }
 
+    @Override
     public void startElement(String aUri, String aLocalName, String aQName, Attributes aAttributes)
throws SAXException {
         super.startElement(aUri, aLocalName, aQName, aAttributes);
+
+        if( m_bRoot )
+        {
+            if( !(aUri.equals(OFFICE_NAMESPACE_URI) && aLocalName.equals(DOCUMENT_META))
)
+                m_aLogger.logError("Invalid root element: " + aQName );
+            m_bRoot = false;
+        }
                 
         if( aUri.equals(META_NAMESPACE_URI) && aLocalName.equals(GENERATOR) )
             m_bInGenerator = true;

Modified: incubator/odf/trunk/validator/src/odfvalidator/ODFFileValidator.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/ODFFileValidator.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/ODFFileValidator.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/ODFFileValidator.java Mon Sep 19 05:31:15
2011
@@ -35,11 +35,11 @@ public class ODFFileValidator extends OD
 
         /** Creates a new instance of ODFFileValidator */
     public ODFFileValidator( File aFile, int nLogLevel, 
-                             int nMode,
+                             int nMode, String aVersion,
                              SAXParseExceptionFilter aFilter,
                              ODFValidatorProvider aValidatorProvider ) throws ODFValidatorException
     {
-        super( nLogLevel, nMode, aFilter, aValidatorProvider );
+        super( nLogLevel, nMode, aVersion, aFilter, aValidatorProvider );
         m_aFile = aFile;
     }
 

Modified: incubator/odf/trunk/validator/src/odfvalidator/ODFPackageValidator.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/ODFPackageValidator.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/ODFPackageValidator.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/ODFPackageValidator.java Mon Sep 19 05:31:15
2011
@@ -47,10 +47,19 @@ import org.xml.sax.helpers.DefaultHandle
  */
 public abstract class ODFPackageValidator implements MetaInformationListener {
 
-    static final int CHECK_CONFORMANCE = 0;
-    static final int VALIDATE = 1;
-    static final int VALIDATE_STRICT = 2;
-        
+    static final int CHECK_CONFORMANCE = 0; // all versions
+    static final int VALIDATE = 1;          // ODF 1.0 and 1.1 only
+    static final int VALIDATE_STRICT = 2;   // ODF 1.0 and 1.1 only
+    static final int CHECK_EXTENDED_CONFORMANCE = 3; // ODF 1.2 only
+
+    static final String ODF_VERSION_10 = "1.0";
+    static final String ODF_VERSION_11 = "1.1";
+    static final String ODF_VERSION_12 = "1.2";
+
+    static final String DOCUMENT_SETTINGS = "document-settings";
+    static final String DOCUMENT_STYLES = "document-styles";
+    static final String DOCUMENT_CONTENT = "document-content";
+
     private int m_nLogLevel;
     private int m_nMode = CHECK_CONFORMANCE;
     private SAXParseExceptionFilter m_aFilter = null;
@@ -58,19 +67,20 @@ public abstract class ODFPackageValidato
     
     private String m_aMediaType = "";
     private String m_aGenerator = "";
-    private String m_aVersion = "";
+    private String m_aConfigVersion = "";
     private Vector<ManifestEntry> m_aSubDocs;
 
     private SAXParserFactory m_aSAXParserFactory = null;
 
 
-    ODFPackageValidator( int nLogLevel, int nMode, String aMediaType,
+    ODFPackageValidator( int nLogLevel, int nMode, String aVersion, String aMediaType,
                              SAXParseExceptionFilter aFilter,ODFValidatorProvider aValidatorProvider)
{
         m_nLogLevel = nLogLevel;
         m_nMode = nMode;
         m_aFilter = aFilter;
         m_aValidatorProvider = aValidatorProvider;
         m_aMediaType = aMediaType;
+        m_aConfigVersion = aVersion;
     }
     
        
@@ -99,20 +109,21 @@ public abstract class ODFPackageValidato
         
         try
         {
-            m_aVersion = getVersion( aLogger );
-            if( m_aVersion != null )
-                aLogger.logInfo( "ODF Version: " + m_aVersion, false );
+            String aDocVersion = getVersion( aLogger );
+            if( aDocVersion != null )
+                aLogger.logInfo( "ODF Version: " + aDocVersion, false );
+            String aVersion = m_aConfigVersion == null ? aDocVersion : m_aConfigVersion;
             
-            bHasErrors |= validateMeta(aOut, getStreamName( OdfDocument.OdfXMLFile.META.getFileName()),
true );
+            bHasErrors |= validateMeta(aOut, getStreamName( OdfDocument.OdfXMLFile.META.getFileName()),
aVersion, true );
             if( bRoot )
-                bHasErrors |= validateManifest(aOut  );
+                bHasErrors |= validateManifest(aOut, aVersion  );
             aLogger.logInfo( "Media Type: " + m_aMediaType , false);
-            bHasErrors |= validateEntry(aOut, getStreamName(OdfDocument.OdfXMLFile.SETTINGS.getFileName()
));
-            bHasErrors |= validateEntry(aOut, getStreamName( OdfDocument.OdfXMLFile.STYLES.getFileName()
));
+            bHasErrors |= validateEntry(aOut, getStreamName(OdfDocument.OdfXMLFile.SETTINGS.getFileName()),
DOCUMENT_SETTINGS, aVersion);
+            bHasErrors |= validateEntry(aOut, getStreamName( OdfDocument.OdfXMLFile.STYLES.getFileName()),
DOCUMENT_STYLES, aVersion );
             if( m_aMediaType.equals(ODFMediaTypes.FORMULA_MEDIA_TYPE))
-                bHasErrors |= validateMathML(aOut, getStreamName( OdfDocument.OdfXMLFile.CONTENT.getFileName()
) );
+                bHasErrors |= validateMathML(aOut, getStreamName( OdfDocument.OdfXMLFile.CONTENT.getFileName()),
aVersion );
             else
-                bHasErrors |= validateEntry(aOut, getStreamName( OdfDocument.OdfXMLFile.CONTENT.getFileName()
) );
+                bHasErrors |= validateEntry(aOut, getStreamName( OdfDocument.OdfXMLFile.CONTENT.getFileName()),
DOCUMENT_CONTENT, aVersion );
             
             if( bRoot )
             {
@@ -124,15 +135,17 @@ public abstract class ODFPackageValidato
                         ManifestEntry aEntry = aIter.next();
                         ODFPackageValidator aPackageValidator = 
                             new ODFSubPackageValidator( aPkg, getLoggerName(), aEntry.m_aFullPath,
aEntry.m_aMediaType,
-                                                  m_nLogLevel, m_nMode, m_aFilter, m_aGenerator,
m_aValidatorProvider );
+                                                  m_nLogLevel, m_nMode, m_aConfigVersion,
m_aFilter, m_aGenerator, m_aValidatorProvider );
                         bHasErrors |= aPackageValidator.validate(aOut);
                     }
                 }
 
-                bHasErrors |= validateDSig( aOut, OdfPackageExt.STREAMNAME_DOCUMENT_SIGNATURES
);
-                bHasErrors |= validateDSig( aOut, OdfPackageExt.STREAMNAME_MACRO_SIGNATURES
);
+                if( aVersion.equals(ODF_VERSION_12))
+                {
+                    bHasErrors |= validateDSig( aOut, OdfPackageExt.STREAMNAME_DOCUMENT_SIGNATURES,
aVersion );
+                    bHasErrors |= validateDSig( aOut, OdfPackageExt.STREAMNAME_MACRO_SIGNATURES,
aVersion );
+                }
             }
-
         }
         catch( ZipException e )
         {
@@ -158,41 +171,43 @@ public abstract class ODFPackageValidato
         return bHasErrors || aLogger.hasError();
     }
     
-    protected boolean validateEntry(PrintStream aOut, String aEntryName ) throws IOException,
ZipException, IllegalStateException, ODFValidatorException
+    protected boolean validateEntry(PrintStream aOut, String aEntryName, String aLocalElementName,
String aVersion ) throws IOException, ZipException, IllegalStateException, ODFValidatorException
     {
         Logger aLogger = new Logger(getLoggerName(),aEntryName,aOut, m_nLogLevel);
-        XMLFilter aFilter = new ContentFilter(aLogger);
-        if( m_nMode == CHECK_CONFORMANCE )
+        XMLFilter aFilter = new ContentFilter(aLogger, aLocalElementName );
+        if( (m_nMode == CHECK_CONFORMANCE && (aVersion.equals(ODF_VERSION_10) ||
aVersion.equals(ODF_VERSION_11))) ||
+            m_nMode == CHECK_EXTENDED_CONFORMANCE )
         {
-            XMLFilter aAlienFilter = new AlienFilter(aLogger);
+            XMLFilter aAlienFilter = new AlienFilter(aLogger,aVersion);
             aAlienFilter.setParent(aFilter);
             aFilter = aAlienFilter;
         }
-        Validator aValidator = m_nMode == VALIDATE_STRICT ? m_aValidatorProvider.getStrictValidator(aOut,m_aVersion)
-                                                          : m_aValidatorProvider.getValidator(aOut,m_aVersion);
+        Validator aValidator = m_nMode == VALIDATE_STRICT ? m_aValidatorProvider.getStrictValidator(aOut,
aVersion)
+                                                          : m_aValidatorProvider.getValidator(aOut,aVersion);
         return validateEntry(aOut, aFilter, aValidator, aLogger, aEntryName );
     }
 
-    private boolean validateMeta(PrintStream aOut, String aEntryName , boolean bIsRoot) throws
IOException, ZipException, IllegalStateException, ODFValidatorException
+    private boolean validateMeta(PrintStream aOut, String aEntryName, String aVersion, boolean
bIsRoot) throws IOException, ZipException, IllegalStateException, ODFValidatorException
     {
         Logger aLogger = new Logger(getLoggerName(),aEntryName,aOut, m_nLogLevel);
         XMLFilter aFilter = new MetaFilter(aLogger, this );
-        if( m_nMode == CHECK_CONFORMANCE )
+        if( (m_nMode == CHECK_CONFORMANCE && (aVersion.equals(ODF_VERSION_10) ||
aVersion.equals(ODF_VERSION_11))) ||
+            m_nMode == CHECK_EXTENDED_CONFORMANCE )
         {
-            XMLFilter aAlienFilter = new AlienFilter(aLogger);
+            XMLFilter aAlienFilter = new AlienFilter(aLogger,aVersion);
             aAlienFilter.setParent(aFilter);
             aFilter = aAlienFilter;
         }
 
-        Validator aValidator = m_nMode == VALIDATE_STRICT ? m_aValidatorProvider.getStrictValidator(aOut,m_aVersion)
-                                                          : m_aValidatorProvider.getValidator(aOut,m_aVersion);
+        Validator aValidator = m_nMode == VALIDATE_STRICT ? m_aValidatorProvider.getStrictValidator(aOut,aVersion)
+                                                          : m_aValidatorProvider.getValidator(aOut,aVersion);
         return validateEntry(aOut, aFilter, aValidator, aLogger, aEntryName );
     }
 
-    private boolean validateMathML(PrintStream aOut, String aEntryName ) throws IOException,
ZipException, IllegalStateException, ODFValidatorException
+    private boolean validateMathML(PrintStream aOut, String aEntryName, String aVersion )
throws IOException, ZipException, IllegalStateException, ODFValidatorException
     {
         Logger aLogger = new Logger(getLoggerName(),aEntryName,aOut, m_nLogLevel);
-        String aMathMLDTDSystemId = m_aValidatorProvider.getMathMLDTDSystemId(m_aVersion);
+        String aMathMLDTDSystemId = m_aValidatorProvider.getMathMLDTDSystemId(aVersion);
         if( aMathMLDTDSystemId != null )
         {
             // validate using DTD
@@ -210,12 +225,12 @@ public abstract class ODFPackageValidato
         }
     }
     
-    private boolean validateManifest(PrintStream aOut ) throws IOException, ZipException,
IllegalStateException, ODFValidatorException
+    private boolean validateManifest(PrintStream aOut, String aVersion ) throws IOException,
ZipException, IllegalStateException, ODFValidatorException
     {
         boolean bRet;
         Logger aLogger = new Logger(getLoggerName(),OdfPackage.OdfFile.MANIFEST.getPath(),aOut,
m_nLogLevel);
         ManifestFilter aFilter = new ManifestFilter(aLogger);
-        Validator aManifestValidator = m_aValidatorProvider.getManifestValidator(aOut,m_aVersion);
+        Validator aManifestValidator = m_aValidatorProvider.getManifestValidator(aOut,aVersion);
         if( aManifestValidator != null )
         {
             bRet = validateEntry(aOut, aFilter, 
@@ -232,9 +247,9 @@ public abstract class ODFPackageValidato
         return bRet;
     }
 
-    protected boolean validateDSig(PrintStream aOut, String aEntryName ) throws IOException,
ZipException, IllegalStateException, ODFValidatorException
+    protected boolean validateDSig(PrintStream aOut, String aEntryName, String aVersion )
throws IOException, ZipException, IllegalStateException, ODFValidatorException
     {
-        Validator aValidator=m_aValidatorProvider.getDSigValidator(aOut,m_aVersion);
+        Validator aValidator=m_aValidatorProvider.getDSigValidator(aOut,aVersion);
         Logger aLogger = new Logger(getLoggerName(),aEntryName,aOut, m_nLogLevel);
         if ( aValidator == null ) {
             aLogger.logWarning("Signature not validated because there is no Signature Validator
configured for the selected Configuration");

Modified: incubator/odf/trunk/validator/src/odfvalidator/ODFRootPackageValidator.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/ODFRootPackageValidator.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/ODFRootPackageValidator.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/ODFRootPackageValidator.java Mon Sep 19
05:31:15 2011
@@ -29,8 +29,8 @@ public abstract class ODFRootPackageVali
 
     private OdfPackage m_aPkg = null;
 
-    ODFRootPackageValidator(int nLogLevel, int nMode, SAXParseExceptionFilter aFilter, ODFValidatorProvider
aValidatorProvider) {
-        super(nLogLevel, nMode, null, aFilter, aValidatorProvider);
+    ODFRootPackageValidator(int nLogLevel, int nMode, String aVersion, SAXParseExceptionFilter
aFilter, ODFValidatorProvider aValidatorProvider) {
+        super(nLogLevel, nMode, aVersion, null, aFilter, aValidatorProvider);
     }
 
     abstract OdfPackage getPackage() throws Exception;

Modified: incubator/odf/trunk/validator/src/odfvalidator/ODFStreamValidator.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/ODFStreamValidator.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/ODFStreamValidator.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/ODFStreamValidator.java Mon Sep 19 05:31:15
2011
@@ -39,11 +39,12 @@ public class ODFStreamValidator extends 
                               String aBaseURI,
                               int nLogLevel, 
                               int nMode,
+                              String aVersion,
                               SAXParseExceptionFilter aFilter,
                               ODFValidatorProvider aValidatorProvider ) 
         
         throws ODFValidatorException {
-        super(nLogLevel, nMode, aFilter, aValidatorProvider );
+        super(nLogLevel, nMode, aVersion, aFilter, aValidatorProvider );
         
         m_aInputStream=aInputStream;
         m_aBaseURI=aBaseURI;

Modified: incubator/odf/trunk/validator/src/odfvalidator/ODFSubPackageValidator.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/ODFSubPackageValidator.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/ODFSubPackageValidator.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/ODFSubPackageValidator.java Mon Sep 19
05:31:15 2011
@@ -31,11 +31,11 @@ public class ODFSubPackageValidator exte
     private String m_aSubEntryName = null;
 
     ODFSubPackageValidator( OdfPackage aPkg, String aBaseURI, String aSubEntryName, String
aMediaType,
-                             int nLogLevel, int nMode, 
+                             int nLogLevel, int nMode, String aVersion,
                              SAXParseExceptionFilter aFilter, String aParentGenerator,
                              ODFValidatorProvider aValidatorProvider ) throws ODFValidatorException
     {
-        super( nLogLevel, nMode, aMediaType, aFilter, aValidatorProvider );
+        super( nLogLevel, nMode, aVersion, aMediaType, aFilter, aValidatorProvider );
         m_aPkg = aPkg;
         m_aBaseURI = aBaseURI + "/" + aSubEntryName;
         m_aSubEntryName = aSubEntryName;

Modified: incubator/odf/trunk/validator/src/odfvalidator/ODFValidator.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/validator/src/odfvalidator/ODFValidator.java?rev=1172432&r1=1172431&r2=1172432&view=diff
==============================================================================
--- incubator/odf/trunk/validator/src/odfvalidator/ODFValidator.java (original)
+++ incubator/odf/trunk/validator/src/odfvalidator/ODFValidator.java Mon Sep 19 05:31:15 2011
@@ -151,7 +151,7 @@ public class ODFValidator implements ODF
     public boolean validateFile(PrintStream aOut, File aDocFile, int nMode, SAXParseExceptionFilter
aFilter ) throws ODFValidatorException
     {
         ODFFileValidator aFileValidator = 
-            new ODFFileValidator( aDocFile, m_nLogLevel, nMode, aFilter, this );
+            new ODFFileValidator( aDocFile, m_nLogLevel, nMode, m_aVersion, aFilter, this
);
         
         boolean result=aFileValidator.validate(aOut);
 
@@ -169,7 +169,7 @@ public class ODFValidator implements ODF
                                   SAXParseExceptionFilter aFilter ) throws ODFValidatorException
     {
         ODFStreamValidator aStreamValidator = 
-            new ODFStreamValidator( aInputStream, aBaseURI, m_nLogLevel, nMode, aFilter,
this );
+            new ODFStreamValidator( aInputStream, aBaseURI, m_nLogLevel, nMode, m_aVersion,
aFilter, this );
 
         boolean result=aStreamValidator.validate(aOut);
         m_aGenerator=aStreamValidator.getGenerator();
@@ -203,8 +203,7 @@ public class ODFValidator implements ODF
         if( m_bUseMathDTD )
         {
             Configuration aConfig = 
-                m_aConfig != null ? m_aConfig
-                                  : getConfiguration( m_aVersion != null ? m_aVersion : aVersion
);
+                m_aConfig != null ? m_aConfig : getConfiguration( aVersion );
 
             aDTD = aConfig.getProperty(Configuration.MATHML_SCHEMA);
             if( m_aConfig == null && aDTD != null && aDTD.length() > 0
 )
@@ -229,8 +228,7 @@ public class ODFValidator implements ODF
     private String getSchemaFileName( String aConfigName, String aVersion) throws ODFValidatorException
     {
         Configuration aConfig = 
-            m_aConfig != null ? m_aConfig
-                              : getConfiguration( m_aVersion != null ? m_aVersion : aVersion
);
+            m_aConfig != null ? m_aConfig : getConfiguration( aVersion );
 
         String aFileName = aConfig.getProperty(aConfigName);
         if( m_aConfig == null && aFileName != null && aFileName.length()
> 0  )



Mime
View raw message