Changeset 92 for Xml/Validator
- Timestamp:
- 09/14/07 11:07:40 (14 months ago)
- Location:
- Xml/Validator/Backend
- Files:
-
- 2 modified
-
OmeValidator.py (modified) (10 diffs)
-
ValidatorBackend.tmproj (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Xml/Validator/Backend/OmeValidator.py
r91 r92 25 25 from stat import * 26 26 27 """ 28 # Load schemas from configured directory 29 import cherrypy 30 # LocalDir for schemas 31 SCHEMA_DIR = cherrypy.config.get("validator.schema", os.path.join(os.getcwd(),"schema")) 32 def schemaFilePath(inFilename): 33 return os.path.join(os.getcwd(), SCHEMA_DIR, inFilename) 34 """ 35 # Load schemas from current directory 36 def schemaFilePath(inFilename): 37 return inFilename 38 27 39 # Try to load Image for XML Schema Vlaidation Support 28 40 haveTiffSupport = True … … 161 173 # build the blank dom 162 174 self.theDom = None 163 164 175 165 176 def __str__(self): … … 212 223 self.validateAgainstSchema() 213 224 225 if len(self.unresolvedList) is not 0 : 226 self.hasUnresolvableIds = True 227 214 228 if self.isXsdValid is True and len(self.errorList) is 0 : 215 229 self.isOmeXml = True … … 257 271 # loading the OME schema to validate against 258 272 try: 259 schema = etree.XMLSchema(etree.parse( theSchemaFile))273 schema = etree.XMLSchema(etree.parse(schemaFilePath(theSchemaFile))) 260 274 except: 261 275 #chosen scema failed to laod … … 277 291 try: 278 292 sax.parse(inFile, handlerContent, handlerError) 293 self.hasCustomAttributes = handlerContent.hasCustomAttributes; 279 294 except sax.SAXParseException: 280 295 self.errorList.append(ParseMessage(None, None, None, "XmlError",None, "Parsing of XML failed")) … … 375 390 # create a file object to represent the xml string 376 391 theFileString = StringIO(theXml) 377 # print theXml378 379 392 # parse the new string/file object into the report and validate it 380 393 theTiffReport.parse(theFileString) 381 394 theTiffReport.validateTiffImageData(image) 382 395 """ 396 # print theXml 383 397 print "Tiff Frames : %s" % theTiffReport.tiffFileFrames 384 398 print "Ome Frames : %s" % theTiffReport.omeTiffDataCount … … 486 500 self.omeTiffDataPlaneCount = 0 487 501 self.theAllFrameCount = 0 502 self.hasCustomAttributes = False 488 503 489 504 # Setup the DOM chunk … … 511 526 except KeyError: 512 527 self.theNamespace = "" 528 529 # save the ID in any elements encountered 530 if name[-16:] == "CustomAttributes": 531 self.hasCustomAttributes = True 513 532 514 533 # save the ID in any elements encountered … … 570 589 if name[-8:] == "TiffData": 571 590 self.omeTiffDataCount = self.omeTiffDataCount + 1 572 # omeTiffDataPlaneCount591 # record the number of planes used by the TiffData block 573 592 if "NumPlanes" in attribs: 574 593 # use the number of planes specified … … 685 704 686 705 if __name__ == '__main__': 687 """for aFilename in ["samples/completesamplenopre.xml","samples/completesample.xml","samples/completesamplenoenc.xml",706 for aFilename in ["samples/completesamplenopre.xml","samples/completesample.xml","samples/completesamplenoenc.xml", 688 707 "samples/sdub.ome", "samples/sdub-fix.ome", "samples/sdub-fix-pre.ome", 689 708 "samples/tiny.ome", "samples/broke.ome"]: 690 709 print "============ XML file %s ============ " % aFilename 691 710 print XmlReport.validateFile(aFilename) 692 """711 693 712 694 713 for aFilename in ["samples/4d2wOME.tif", "samples/4d2wOME-fixed.tif", -
Xml/Validator/Backend/ValidatorBackend.tmproj
r89 r92 17 17 <string>OmeValidator.py</string> 18 18 <key>lastUsed</key> 19 <date>2007-09-1 2T10:04:09Z</date>19 <date>2007-09-13T09:19:26Z</date> 20 20 <key>selected</key> 21 21 <true/> … … 53 53 <dict> 54 54 <key>column</key> 55 <integer>2 </integer>55 <integer>21</integer> 56 56 <key>line</key> 57 <integer> 202</integer>57 <integer>35</integer> 58 58 </dict> 59 59 <key>firstVisibleColumn</key> 60 60 <integer>0</integer> 61 61 <key>firstVisibleLine</key> 62 <integer> 140</integer>62 <integer>0</integer> 63 63 </dict> 64 64 <key>samples/completesamplenoenc.xml</key> … … 142 142 <true/> 143 143 <key>windowFrame</key> 144 <string>{{ 402, 269}, {954, 778}}</string>144 <string>{{162, 48}, {1189, 830}}</string> 145 145 </dict> 146 146 </plist>
