• Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Change
  • Next Change →

Changeset 130 for Xml/Validator/WebApp/validator/OmeValidator.py

Show
Ignore:
Timestamp:
01/09/08 10:55:14 (11 months ago)
Author:
andrew
Message:

Updated to report multiple errors not just the last.
Updated error message used if the system xml validator generates an error.

Files:
1 modified

  • Xml/Validator/WebApp/validator/OmeValidator.py (modified) (6 diffs)

Legend:

Unmodified
Added
Removed
  • Xml/Validator/WebApp/validator/OmeValidator.py

    r120 r130  
    3737        return inFilename 
    3838""" 
    39 # Try to load Image for XML Schema Vlaidation Support 
     39# Try to load Image for Tiff Support 
    4040haveTiffSupport = True 
    4141try: 
    … …  
    4545        haveTiffSupport = False 
    4646 
    47 # Try to load lxml for XML Schema Vlaidation Support 
     47# Try to load lxml for XML Schema Validation Support 
    4848haveXsdSupport = True 
    4949try: 
    … …  
    221221                # mark xlm as having been parsed 
    222222                self.hasParsedXml = True 
    223                  
     223 
    224224                # look at file for Ids, Refs, and namespaces 
    225225                self.scanForIdsAndNamespace(inFile) 
    … …  
    233233                if self.isXsdValid is True and len(self.errorList) is 0 : 
    234234                        self.isOmeXml = True 
    235                                  
     235         
    236236        def validateAgainstSchema(self): 
    237237                if not haveXsdSupport: 
    … …  
    255255                 
    256256                # validating the documnet tree against the loaded schema 
    257                 # this should not throw an exception 
     257                # according to the docs this should not throw an exception - but it does! 
    258258                try: 
    259259                        schema.validate(document) 
    260                         err = schema.error_log.last_error 
    261                         if err: 
     260                        self.isXsdValid = True 
     261                        for err in schema.error_log: 
    262262                                self.isXsdValid = False 
    263263                                self.errorList.append(ParseMessage(None, err.line, None, "XSD", None, err.message)) 
    264                         else: 
    265                                 self.isXsdValid = True 
    266264                except etree.XMLSchemaValidateError: 
    267265                        self.isXsdValid = False 
    268                         self.errorList.append(ParseMessage(None, None, None, "XML", None, "Internal error in the system XML Schema validation module")) 
     266                        self.errorList.append(ParseMessage(None, None, None, "XML", None, "Processing the XML data has generated an unspecified error in the XML sub-system. This is usually a result of an incorrect top level block. Please check the OME block is well-formed and that the schemaLocation is specified correctly. This may also be caused by a missing namespace prefix or incorrect xmlns attribute.")) 
    269267                         
    270268         
    … …  
    471469                        self.errorList.append(ParseMessage(None, None, None, "TIFF", ("Frames %s out of %s" % (self.tiffFileFrames,totalTiffDataFrames)) , "Not all required frames are present in this Tiff file")) 
    472470                        self.isOmeTiffConsistent = False 
    473  
     471                 
    474472# Used by sax parser to handle errors when processing Elements 
    475473class ParseErrorHandler(sax.ErrorHandler): 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/