예제 #1
0
def extraktTrxFromXml(value):
    root = xml.fromstring(value)
    trx = Trx()
    for attribute in vars(trx).items():
        trx.__setattr__(attribute[0], root.get(attribute[0]))
    return trx
예제 #2
0
import xml.etree.ElementTree as xml
# import re
from Trx import Trx



def extraktTrxFromXml(value):
    root = xml.fromstring(value)
    trx = Trx()
    for attribute in vars(trx).items():
        trx.__setattr__(attribute[0], root.get(attribute[0]))
    return trx

if __name__ == '__main__':
    inTrx = None
    trx = Trx()
    print trx.getAttribute()
    
    for line in sys.stdin:
        line = line.strip()

        if line.find("<TRX") != -1:
            
#             outterXml = re.findall('(<TRX.*/>$)', line)
#             if (len(outterXml)>0):
#                 print extraktTrxFromXml(outterXml[0])
#                 pass
#             else:    
                inTrx = True
                xmlBuffer = cStringIO.StringIO()  # @UndefinedVariable
                xmlBuffer.write(line)