2010-08-30, 17:27
Regarding the code only this should be interesting for you (the commented part in temptests.py):
You just need to download descriptionparser.py and pyparsing.py and should be able to run the above code. I think you can also do something like "result.asXml()" if you like this more. But I have to check the pyparsing API for this.
Code:
print "start parsing"
BASE_RESOURCE_PATH = os.path.join( os.getcwd())
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "pyparsing" ) )
from descriptionparser import *
descParser = DescriptionParser()
descFile = "F:\\Emulatoren\\data\\Synopsis\\SNES.txt"
parseInstruction = "F:\\Emulatoren\\data\\Synopsis\\parserConfig.xml"
results = descParser.parseDescription(descFile, parseInstruction, '')
for result in results:
print result.asDict()
print len(results)
You just need to download descriptionparser.py and pyparsing.py and should be able to run the above code. I think you can also do something like "result.asXml()" if you like this more. But I have to check the pyparsing API for this.