Changeset b651ed in git
- Timestamp:
- Jun 14, 2005, 5:44:55 PM (18 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- 859b51c6367722cffc34100946fcb3cb3631f282
- Parents:
- 9b973c144b1c3a7ddd2df88833b75055fc1688ae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/openmathserver/omxmlreader.py
r9b973c rb651ed 71 71 return self.buildFromNode(root) 72 72 #TODO: handle hex floats 73 #TODO: handle floats 73 74 #TODO: handle ancestors cdbase 74 75 if __name__=='__main__': 75 if len(argv<=2): 76 import arith1 77 78 if len(sys.argv)<=2: 76 79 print "Usage: python omxmlreader [--evaluate] input output" 77 for arg in argv: 78 80 state=0 81 eval=False 82 #TODO: use optparse 83 for arg in sys.argv[1:]: 84 if state==0: 85 if arg=="--evaluate": 86 eval=True 87 else: 88 inputf=arg 89 state=1 90 continue 91 if state==1: 92 outputf=arg 93 continue 94 if state==2: 95 print "argument ignored:", arg 79 96 from context import Context 80 inputf=sys.argv[1]97 #inputf=sys.argv[1] 81 98 root=readFile(inputf) 82 99 builder=OMFromXMLBuilder() 83 100 context=Context() 84 85 print context.XMLEncodeObject(builder.build(root)) 101 context.addCDImplementation(arith1.implementation) 102 doc=builder.build(root) 103 if eval: 104 doc=context.evaluate(doc) 105 output=context.XMLEncodeObject(doc) 106 try: 107 out=open(outputf,"w") 108 except NameError: 109 print "no output file" 110 sys.exit(1) 111 out.write(output) 112 out.close() 86 113 #print repr(root.getAttribute("blabla"))
Note: See TracChangeset
for help on using the changeset viewer.