def __init__(self, part): """ Constructs a Parser object for a specific read type in an infinite result .xml """ self.xml = objectify.fromstring(etree.tostring(part)) self.wc = XMLWalker(self.xml) self._wells = {}
def __init__(self, xml): """ Constructs a Parser object for Infinite Result .xml """ self.xml = objectify.fromstring(etree.tostring(xml)) self.barcode = self.xml.xpath('/MeasurementResultData/Plate/BC/text()') self.sections = self.xml.xpath('/MeasurementResultData/Section') self.wc = XMLWalker(self.xml) xp = "//Section/Data?run:int=@Cycle" + "/Well?well=@Pos/Single?value:int=text()" xp = "//Section/Data?run:int=@Cycle/Well?well=@Pos/Multiple?location:well1=@MRW_Position&value=text()" pr = AbsorbanceMultiRead(self.sections[0]) print pr.result
# This actually calls the update o.id = 1 # And show all ids print o.id # print etree.tostring(o.xobj , pretty_print = True) o2 = XMLBind(objectify.fromstring(template), namespaces={'ns': 'tecan.at.schema.documents'}) for key, value in o2.inspect(unique=True).iteritems(): print key, ":", value # Walker Test with namespace wc = XMLWalker(root) xp = "//ReadingFilter?type=@type" result = wc.walk( XPathAnalyzer(xp, namespaces={'ns': 'tecan.at.schema.documents'})) print len(result) print result # Walker Test without namespace root = objectify.fromstring(etree.tostring(objectify.parse('gen.xml'))) wc = XMLWalker(root) xp = "//Well?pos=@Pos/Scan?wave=@WL&val=text()"
else: d['plate_rows'] = 0 d['plate_columns'] = 0 del d['plate_wells'] c = Container(d) c.store(d.keys()) filename = 'imports/containerTypes.cfg.txt' s = etree.tostring(objectify.parse(filename), pretty_print=True) s = string.replace(s, '\\', '/') s = s.decode('unicode_escape').encode('ascii', 'ignore') root = objectify.fromstring(s) wk = XMLWalker(root) definition = { 'general_id': '/Name', 'general_name_short': '/Name', 'general_name': '/Name', 'general_description': '/Description', 'general_image': '/ImagePath', 'manufacturer_name': '/Manufacturer', 'manufacturer_url': '/ManufacturerUrl', 'manufacturer_number': '/PartNumber', 'manufacturer_product_url': '/ProductInformationUrl', 'id_momentum': '/Id', 'plate_height': '/Height', 'plate_length': '/Length', 'plate_width': '/Width',