Public Member Functions | |
def | endElement |
def | startElement |
Definition at line 35 of file geometryXMLtoCSV.py.
def geometryXMLtoCSV::ContentHandler::endElement | ( | self, | ||
tag | ||||
) |
Definition at line 73 of file geometryXMLtoCSV.py.
00073 : 00074 if tag == "operation": 00075 print "" # end current line (note: no comma) 00076 00077 # Actually make it and use it on "stdin" (a file object) parser = make_parser()
def geometryXMLtoCSV::ContentHandler::startElement | ( | self, | ||
tag, | ||||
attrib | ||||
) |
Definition at line 37 of file geometryXMLtoCSV.py.
00037 : 00038 attrib = dict(attrib.items()) 00039 if "rawId" in attrib: raise Exception, "Please use \"rawIds = false\"" 00040 if "aa" in attrib: raise Exception, "Please use \"survey = false\"" 00041 00042 # <DT...>: print wheel/station/sector/superlayer/layer 00043 if tag[0:2] == "DT": 00044 print tag, # ending with a comma means "don't print end-of-line character" 00045 for a in "wheel", "station", "sector", "superlayer", "layer": 00046 if a in attrib: 00047 print (", %s" % attrib[a]), 00048 else: 00049 print ", ", 00050 00051 # <CSC...>: print endcap/station/ring/chamber/layer 00052 elif tag[0:3] == "CSC": 00053 print tag, 00054 for a in "endcap", "station", "ring", "chamber", "layer": 00055 if a in attrib: 00056 print (", %s" % attrib[a]), 00057 else: 00058 print ", ", 00059 00060 # <setposition>: print x, y, z and phix, phiy, phiz or alpha, beta, gamma 00061 elif tag == "setposition": 00062 print (", %(relativeto)s, %(x)s, %(y)s, %(z)s" % attrib), 00063 if "phix" in attrib: 00064 print (", phixyz, %(phix)s, %(phiy)s, %(phiz)s" % attrib), 00065 else: 00066 print (", Euler, %(alpha)s, %(beta)s, %(gamma)s" % attrib), 00067 00068 # <setape>: print xx, xy, xz, yy, yz, zz 00069 elif tag == "setape": 00070 print (", %(xx)s, %(xy)s, %(xz)s, %(yy)s, %(yz)s, %(zz)s" % attrib), 00071 00072 # what to do when you get to an </endelement> def endElement(self, tag):