Exemplo n.º 1
0
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'
Exemplo n.º 2
0
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'
Exemplo n.º 3
0
 def createMetaDictionaryDtd(self):
     
     # Parse DTD
     try:
         self.dictionary = stgDtd.readXML( self.xmlText )
     except:
         print 'Failed to parse as a StGermain DTD'
         raise
Exemplo n.º 4
0
    def createMetaDictionaryDtd(self):

        # Parse DTD
        try:
            self.dictionary = stgDtd.readXML(self.xmlText)
        except:
            print 'Failed to parse as a StGermain DTD'
            raise
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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 )
Exemplo n.º 7
0
    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
Exemplo n.º 8
0
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
Exemplo n.º 9
0
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
Exemplo n.º 10
0
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