def _handleLxmlConfigNode(self, session, node): # Source if (node.tag == "source"): xpaths = [] for child in node.iterchildren(tag=etree.Element): if child.tag == "xpath": # add XPath ref = child.attrib.get('ref', '') if ref: xp = self.get_object(session, ref) else: xp = SimpleXPathProcessor(session, node, self) xp._handleLxmlConfigNode(session, node) self.sources.append(xp)
def _handleConfigNode(self, session, node): # Source if (node.localName == "source"): xpaths = [] for child in node.childNodes: if child.nodeType == elementType: if child.localName == "xpath": # add XPath ref = child.getAttributeNS(None, 'ref') if ref: xp = self.get_object(session, ref) else: xp = SimpleXPathProcessor(session, node, self) xp._handleConfigNode(session, node) self.sources.append(xp)
def _handleLxmlConfigNode(self, session, node): # Source if (node.tag == "source"): key = node.attrib.get('id', None) default = node.attrib.get('default', None) process = None preprocess = None xp = None for child in node.iterchildren(tag=etree.Element): if child.tag == "xpath": if xp == None: ref = child.attrib.get('ref', '') if ref: xp = self.get_object(session, ref) else: node.set('id', self.id + '-xpath') xp = SimpleXPathProcessor(session, node, self) xp._handleLxmlConfigNode(session, node) elif child.tag == "preprocess": # turn preprocess chain to workflow ref = child.attrib.get('ref', '') if ref: preprocess = self.get_object(session, ref) else: # create new element e = etree.XML(etree.tostring(child)) e.tag = 'workflow' e.set('id', self.id + "-preworkflow") preprocess = CachingWorkflow(session, child, self) preprocess._handleLxmlConfigNode(session, child) elif child.tag == "process": # turn xpath chain to workflow ref = child.attrib.get('ref', '') if ref: process = self.get_object(session, ref) else: # create new element e = etree.XML(etree.tostring(child)) e.tag = 'workflow' e.set('id', self.id + "-workflow") process = CachingWorkflow(session, e, self) process._handleLxmlConfigNode(session, e) self.sources[key] = { 'source': (xp, process, preprocess), 'default': default }
def _handleLxmlConfigNode(self, session, node): # Source if (node.tag in ['source', '{%s}source' % CONFIG_NS]): key = node.attrib.get('id', None) default = node.attrib.get('default', None) process = None preprocess = None xp = None for child in node.iterchildren(tag=etree.Element): if child.tag in ['xpath', '{%s}xpath' % CONFIG_NS]: if xp is None: ref = child.attrib.get('ref', '') if ref: xp = self.get_object(session, ref) else: node.set('id', self.id + '-xpath') xp = SimpleXPathProcessor(session, node, self) xp._handleLxmlConfigNode(session, node) elif child.tag in ['preprocess', '{%s}preprocess' % CONFIG_NS]: # turn preprocess chain to workflow ref = child.attrib.get('ref', '') if ref: preprocess = self.get_object(session, ref) else: # create new element e = etree.XML(etree.tostring(child)) e.tag = 'workflow' e.set('id', self.id + "-preworkflow") preprocess = CachingWorkflow(session, child, self) preprocess._handleLxmlConfigNode(session, child) elif child.tag in ["process", '{%s}process' % CONFIG_NS]: # turn xpath chain to workflow ref = child.attrib.get('ref', '') if ref: process = self.get_object(session, ref) else: # create new element e = etree.XML(etree.tostring(child)) e.tag = 'workflow' e.set('id', self.id + "-workflow") process = CachingWorkflow(session, e, self) process._handleLxmlConfigNode(session, e) self.sources[key] = {'source': (xp, process, preprocess), 'default': default}
def _handleLxmlConfigNode(self, session, node): # Source if node.tag == "source": key = node.attrib.get("id", None) default = node.attrib.get("default", None) process = None preprocess = None xp = None for child in node.iterchildren(tag=etree.Element): if child.tag == "xpath": if xp == None: ref = child.attrib.get("ref", "") if ref: xp = self.get_object(session, ref) else: node.set("id", self.id + "-xpath") xp = SimpleXPathProcessor(session, node, self) xp._handleLxmlConfigNode(session, node) elif child.tag == "preprocess": # turn preprocess chain to workflow ref = child.attrib.get("ref", "") if ref: preprocess = self.get_object(session, ref) else: # create new element e = etree.XML(etree.tostring(child)) e.tag = "workflow" e.set("id", self.id + "-preworkflow") preprocess = CachingWorkflow(session, child, self) preprocess._handleLxmlConfigNode(session, child) elif child.tag == "process": # turn xpath chain to workflow ref = child.attrib.get("ref", "") if ref: process = self.get_object(session, ref) else: # create new element e = etree.XML(etree.tostring(child)) e.tag = "workflow" e.set("id", self.id + "-workflow") process = CachingWorkflow(session, e, self) process._handleLxmlConfigNode(session, e) self.sources[key] = {"source": (xp, process, preprocess), "default": default}