Ejemplo n.º 1
0
    def __init__(self, configdict, section='gml_splitter'):
        Filter.__init__(self, configdict, section, consumes=FORMAT.xml_line_stream, produces=FORMAT.etree_doc)

        log.info("cfg = %s" % self.cfg.to_string())
        self.max_features = self.cfg.get_int('max_features', 10000)
        # File preamble
        self.start_container = self.cfg.get('start_container')
        # File postamble
        self.end_container = self.cfg.get('end_container')
        self.container_tag = self.cfg.get('container_tag')
        #        self.feature_tags = self.cfg.get('feature_tags').split(',')
        self.start_feature_markers = self.cfg.get('start_feature_markers').split(',')
        self.end_feature_markers = self.cfg.get('end_feature_markers').split(',')
        self.feature_count = 0
        self.total_feature_count = 0
        self.in_heading = True

        # End of file is line with end_container_tag
        self.end_container_tag = '</%s' % self.container_tag

        # Derive start and end tags from feature_tags
        #        for feature_tag in self.feature_tags:
        #            self.start_feature_markers.append('<%s' % feature_tag)
        #            self.end_feature_markers.append('</%s>' % feature_tag)
        self.expect_end_feature_markers = []
        self.expect_end_feature_tag = None
        self.buffer = None
        # Reusable XML parser
        self.xml_parser = etree.XMLParser(remove_blank_text=True)
Ejemplo n.º 2
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.string, produces=FORMAT.etree_element)
     self.context = None
     self.root = None
     self.cur_file_path = None
     self.elem_count = 0
     log.info("Element tags to be matched: %s" % self.element_tags)
Ejemplo n.º 3
0
    def __init__(self, configdict, section):
        Filter.__init__(self, configdict, section, consumes=FORMAT.etree_element, produces=FORMAT.etree_element)

        # Create specific preparer object from given class name string
        self.prep_class = self.cfg.get('prep_class')
        self.prep_class = factory.class_forname(self.prep_class)
        self.preparer = self.prep_class('stetl')
Ejemplo n.º 4
0
    def __init__(self, configdict, section):
        Filter.__init__(self, configdict, section, consumes=FORMAT.etree_doc, produces=FORMAT.etree_doc)

        self.xslt_file = open(self.script, 'r')

        # Parse XSLT file only once
        self.xslt_doc = etree.parse(self.xslt_file)
        self.xslt_obj = etree.XSLT(self.xslt_doc)
        self.xslt_file.close()
Ejemplo n.º 5
0
    def __init__(self, configdict, section):
        Filter.__init__(self, configdict, section, consumes=FORMAT.etree_element, produces=FORMAT.etree_doc)

        log.info("cfg = %s" % self.cfg.to_string())
        self.max_elements = self.cfg.get_int('max_elements', 10000)
        self.container_doc = self.cfg.get('container_doc')
        self.element_container_xpath = XmlAssembler.xpath_base % self.cfg.get('element_container_tag')
        self.total_element_count = 0
        self.element_arr = []

        # Reusable XML parser
        self.xml_parser = etree.XMLParser(remove_blank_text=True)
Ejemplo n.º 6
0
    def __init__(self, configdict, section='gml_feature_extractor'):
        Filter.__init__(self, configdict, section, consumes=FORMAT.etree_doc, produces=FORMAT.etree_feature_array)

        log.info("cfg = %s" % self.cfg.to_string())

        # Build the Xpath expresion from configures tagnames
        self.feature_tags = self.cfg.get('feature_tags').split(',')
        self.total_features = 0
        self.xpath_expression = ''
        index = 0
        for feature_tag in self.feature_tags:
            if index > 0:
                self.xpath_expression += '|'
            self.xpath_expression += GmlFeatureExtractor.xpath_base % feature_tag
            index += 1

        log.info("xpath expression = %s" % self.xpath_expression)
Ejemplo n.º 7
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.any, produces=FORMAT.any)
     self.packet_list = []
Ejemplo n.º 8
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.record, produces=FORMAT.string)
     self.cur_file_path = self.cfg.get('file_path')
Ejemplo n.º 9
0
 def __init__(self, configdict, section, consumes, produces):
     Filter.__init__(self, configdict, section, consumes, produces)
Ejemplo n.º 10
0
 def __init__(self, configdict, section, consumes=FORMAT.any, produces=FORMAT.any):
     Filter.__init__(self, configdict, section, consumes, produces)
Ejemplo n.º 11
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.record, produces=FORMAT.record_array)
     self.current_record = None
Ejemplo n.º 12
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.geojson_collection, produces=FORMAT.geojson_collection)
Ejemplo n.º 13
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.any, produces=FORMAT.any)
     self.packet_list = []
Ejemplo n.º 14
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.any, produces=FORMAT.any)
     self.converter = None
Ejemplo n.º 15
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.etree_doc, produces=FORMAT.etree_doc)
Ejemplo n.º 16
0
 def __init__(self, configdict, section, consumes, produces):
     Filter.__init__(self, configdict, section, consumes, produces)
Ejemplo n.º 17
0
 def __init__(self, configdict, section, consumes=FORMAT.string, produces=FORMAT.string):
     Filter.__init__(self, configdict, section, consumes, produces)
Ejemplo n.º 18
0
    def __init__(self, configdict, section, consumes=FORMAT.string, produces=FORMAT.record):
        Filter.__init__(self, configdict, section, consumes, produces)

        self.regex_object = re.compile(self.pattern_string, re.S)
Ejemplo n.º 19
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.etree_doc, produces=FORMAT.etree_doc)
     self.enabled = self.cfg.get_bool('enabled', True)
     self.xsd = self.cfg.get('xsd')
     log.info("Building the Schema once with (GML XSD) dependencies for schema=%s (be patient...)" % self.xsd)
     self.schema = etree.XMLSchema(etree.parse(self.xsd))
Ejemplo n.º 20
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.any, produces=FORMAT.string)
     log.info("working dir %s" % os.getcwd())
Ejemplo n.º 21
0
 def __init__(self, configdict, section):
     Filter.__init__(self, configdict, section, consumes=FORMAT.line_stream, produces=FORMAT.record)
     self.current_record = None