Exemplo n.º 1
0
    def __init__(self, name):
        self.doc = x.load_xml_document("service/edp/resources/workflow.xml",
                                       strip=True)
        self.tag_name = name

        x.add_child(self.doc, 'action', self.tag_name)

        ok_elem = xml.parseString('<%s to="%s"/>' % ("ok", "end"))
        x.add_element(self.doc, 'action', ok_elem.firstChild)
        error_elem = xml.parseString('<%s to="%s"/>' % ("error", "fail"))
        x.add_element(self.doc, 'action', error_elem.firstChild)

        x.add_text_element_to_tag(self.doc, self.tag_name,
                                  'job-tracker', "${jobTracker}")
        x.add_text_element_to_tag(self.doc, self.tag_name,
                                  'name-node', "${nameNode}")
Exemplo n.º 2
0
    def __init__(self, name):
        self.doc = x.load_xml_document("service/edp/resources/workflow.xml",
                                       strip=True)
        self.tag_name = name

        x.add_child(self.doc, 'action', self.tag_name)

        ok_elem = xml.parseString('<%s to="%s"/>' % ("ok", "end"))
        x.add_element(self.doc, 'action', ok_elem.firstChild)
        error_elem = xml.parseString('<%s to="%s"/>' % ("error", "fail"))
        x.add_element(self.doc, 'action', error_elem.firstChild)

        x.add_text_element_to_tag(self.doc, self.tag_name, 'job-tracker',
                                  "${jobTracker}")
        x.add_text_element_to_tag(self.doc, self.tag_name, 'name-node',
                                  "${nameNode}")
Exemplo n.º 3
0
 def _get_xml_text(self, strip):
     doc = x.load_xml_document("service/edp/resources/workflow.xml", strip)
     x.add_child(doc, 'action', 'java')
     x.add_text_element_to_tag(doc, 'java', 'sometag', 'somevalue')
     return doc.toprettyxml(indent="  ").split("\n")
Exemplo n.º 4
0
 def _get_xml_text(self, strip):
     doc = x.load_xml_document("service/edp/resources/workflow.xml", strip)
     x.add_child(doc, 'action', 'java')
     x.add_text_element_to_tag(doc, 'java', 'sometag', 'somevalue')
     return doc.toprettyxml(indent="  ").split("\n")
Exemplo n.º 5
0
def load_xml_file(path):
    kv_mapper = lambda i: (x._get_text_from_node(i, 'name'),
                           x._adjust_field(x._get_text_from_node(i, 'value')))
    strip_mapper = lambda i: (i[0].strip(), i[1].strip())
    props = x.load_xml_document(path).getElementsByTagName('property')
    return dict(map(strip_mapper, map(kv_mapper, props)))
Exemplo n.º 6
0
def load_xml_file(path):
    kv_mapper = lambda i: (x.get_text_from_node(i, 'name'),
                           x._adjust_field(x.get_text_from_node(i, 'value')))
    strip_mapper = lambda i: (i[0].strip(), i[1].strip())
    props = x.load_xml_document(path).getElementsByTagName('property')
    return dict(map(strip_mapper, map(kv_mapper, props)))