Files
mars-elt/python/mrds_common/mrds/processors/xml_processor.py
Grzegorz Michalski 2c225d68ac init
2026-03-02 09:47:35 +01:00

31 lines
905 B
Python

import logging
from .base import TaskProcessor
from mrds.utils import (
xml_utils,
csv_utils,
)
class XMLTaskProcessor(TaskProcessor):
def _extract(self):
# Extract data from XML
csv_data = xml_utils.extract_data(
self.global_config.source_filepath,
self.xpath_entries,
self.xml_position_entries,
self.task_conf.namespaces,
self.workflow_context,
self.global_config.encoding_type,
)
logging.info(f"CSV data extracted for task '{self.task_conf.task_name}'")
# Generate CSV
logging.info(f"Writing core data to CSV file at '{self.output_filepath}'")
csv_utils.write_data_to_csv_file(
self.output_filepath, csv_data, self.global_config.encoding_type
)
logging.info(f"Core data written to CSV file at '{self.output_filepath}'")