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

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 119

Show
Ignore:
Timestamp:
10/31/07 10:59:01 (10 months ago)
Author:
andrew
Message:

Added block to catch exception from XML parser.

Location:
Xml/Validator
Files:
3 modified

  • Backend/OmeValidator.py (modified) (1 diff)
  • Backend/ValidatorBackend.tmproj (modified) (2 diffs)
  • WebApp/validator/OmeValidator.py (modified) (1 diff)

Legend:

Unmodified
Added
Removed
  • Xml/Validator/Backend/OmeValidator.py

    r115 r119  
    255255                 
    256256                # validating the documnet tree against the loaded schema 
    257                 # this should not throw an exception 
    258                 schema.validate(document) 
    259                 err = schema.error_log.last_error 
    260                 if err: 
     257                # according to the docs this should not throw an exception - but it does! 
     258                try: 
     259                        schema.validate(document) 
     260                        err = schema.error_log.last_error 
     261                        if err: 
     262                                self.isXsdValid = False 
     263                                self.errorList.append(ParseMessage(None, err.line, None, "XSD", None, err.message)) 
     264                        else: 
     265                                self.isXsdValid = True 
     266                except XMLSchemaValidateError: 
    261267                        self.isXsdValid = False 
    262                         self.errorList.append(ParseMessage(None, err.line, None, "XSD", None, err.message)) 
    263                 else: 
    264                         self.isXsdValid = True 
     268                        self.errorList.append(ParseMessage(None, None, None, "XML", None, "Internal error in the system XML Schema validation module")) 
     269                         
    265270         
    266271        def loadChoosenSchema(self): 
  • Xml/Validator/Backend/ValidatorBackend.tmproj

    r115 r119  
    2222                        <key>lastUsed</key> 
    2323                        <date>2007-10-16T18:37:26Z</date> 
    24                         <key>selected</key> 
    25                         <true/> 
    2624                </dict> 
    2725                <dict> 
    … …  
    2927                        <string>OmeValidator.py</string> 
    3028                        <key>lastUsed</key> 
    31                         <date>2007-10-16T18:37:24Z</date> 
     29                        <date>2007-10-26T16:09:53Z</date> 
     30                        <key>selected</key> 
     31                        <true/> 
    3232                </dict> 
    3333                <dict> 
  • Xml/Validator/WebApp/validator/OmeValidator.py

    r116 r119  
    256256                # validating the documnet tree against the loaded schema 
    257257                # this should not throw an exception 
    258                 schema.validate(document) 
    259                 err = schema.error_log.last_error 
    260                 if err: 
     258                try: 
     259                        schema.validate(document) 
     260                        err = schema.error_log.last_error 
     261                        if err: 
     262                                self.isXsdValid = False 
     263                                self.errorList.append(ParseMessage(None, err.line, None, "XSD", None, err.message)) 
     264                        else: 
     265                                self.isXsdValid = True 
     266                except XMLSchemaValidateError: 
    261267                        self.isXsdValid = False 
    262                         self.errorList.append(ParseMessage(None, err.line, None, "XSD", None, err.message)) 
    263                 else: 
    264                         self.isXsdValid = True 
     268                        self.errorList.append(ParseMessage(None, None, None, "XML", None, "Internal error in the system XML Schema validation module")) 
     269                         
    265270         
    266271        def loadChoosenSchema(self): 

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/