1#!/usr/bin/env python3 2# 3# Copyright (C) 2022 Intel Corporation. 4# 5# SPDX-License-Identifier: BSD-3-Clause 6# 7 8from defusedxml.ElementTree import parse 9from pipeline import PipelineStage 10 11class XMLLoadStage(PipelineStage): 12 def __init__(self, tag): 13 self.consumes = f"{tag}_path" 14 self.provides = f"{tag}_etree" 15 16 def run(self, obj): 17 xml_path = obj.get(self.consumes) 18 etree = parse(xml_path) 19 obj.set(self.provides, etree) 20