def main(argv=None): if argv == None: argv = sys.argv dirname = argv[1] failed = [] filenameList = util.dirEntries(dirname, True, 'meta') for filename in filenameList: print(filename + '...') try: # Read the file into a string xml_file = file(filename) xml_lines = xml_file.readlines() xml_text = "" for l in xml_lines: xml_text += str(l) dtdDict = stgDtd.readXML(xml_text) pprint.pprint(dtdDict) except: failed.append(filename) if len(failed): print 'Failed list (' + str(len(failed)) + ' of ' + str( len(filenameList)) + ')... ' pprint.pprint(failed) else: print 'All ' + str(len(filenameList)) + ' passed parsing test'
def main( argv = None ): if argv == None: argv = sys.argv dirname = argv[1] failed = [] filenameList = util.dirEntries( dirname, True, 'meta' ) for filename in filenameList: print( filename + '...' ) try: # Read the file into a string xml_file = file( filename ) xml_lines = xml_file.readlines() xml_text = "" for l in xml_lines: xml_text += str(l) dtdDict = stgDtd.readXML( xml_text ) pprint.pprint( dtdDict ) except: failed.append( filename ) if len( failed ): print 'Failed list (' + str( len( failed ) ) + ' of ' + str( len( filenameList ) ) + ')... ' pprint.pprint( failed ) else: print 'All ' + str( len( filenameList ) ) + ' passed parsing test'
def createMetaDictionaryDtd(self): # Parse DTD try: self.dictionary = stgDtd.readXML( self.xmlText ) except: print 'Failed to parse as a StGermain DTD' raise
def createMetaDictionaryDtd(self): # Parse DTD try: self.dictionary = stgDtd.readXML(self.xmlText) except: print 'Failed to parse as a StGermain DTD' raise
def main(argv=None): if argv == None: argv = sys.argv filename = argv[1] # Read the file into a string xml_file = file(filename) xml_lines = xml_file.readlines() xml_text = "" for l in xml_lines: xml_text += str(l) dtdDict = stgDtd.readXML(xml_text) pprint.pprint(dtdDict)
def main( argv = None ): if argv == None: argv = sys.argv filename = argv[1] # Read the file into a string xml_file = file( filename ) xml_lines = xml_file.readlines() xml_text = "" for l in xml_lines: xml_text += str(l) dtdDict = stgDtd.readXML( xml_text ) pprint.pprint( dtdDict )
def loadXML(filename): xml_file = file(filename) xml_lines = xml_file.readlines() xml_text = "" for l in xml_lines: xml_text += str(l) try: dtdDict = stgDtd.readXML(xml_text) except: print 'Failed to parse as a StGermain DTD' raise try: return convert.dtdDict2metaXsdDict(dtdDict) except: print 'Failed to convert information from a StGermain Meta DTD to a StGermain Meta XSD' raise
def loadXML( filename ): xml_file = file( filename ) xml_lines = xml_file.readlines() xml_text = "" for l in xml_lines: xml_text += str(l) try: dtdDict = stgDtd.readXML( xml_text ) except: print 'Failed to parse as a StGermain DTD' raise try: return convert.dtdDict2metaXsdDict( dtdDict ) except: print 'Failed to convert information from a StGermain Meta DTD to a StGermain Meta XSD' raise
def dtd2MetaXsd( xml_text ): # Parse DTD try: dtd = stgDtd.readXML( xml_text ) except: print 'Failed to parse as a StGermain DTD' raise # Convert DTD-dict to XSD-dict try: xsd = dtdDict2metaXsdDict( dtd ) except: print 'Failed to convert information from a StGermain Meta DTD to a StGermain Meta XSD' raise # Write XSD try: doc = stgMetaXsd.createXML( xsd ) return doc.toprettyxml() except: print 'Failed to write to StGermain Meta XSD' raise