Skip to content

Commit

Permalink
get namespace from arxml file
Browse files Browse the repository at this point in the history
Change makes it independable of the used AUTOSAR version within arxml file.
  • Loading branch information
Jürgen Altszeimer committed Aug 1, 2021
1 parent bd2179a commit 2853112
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arxml_data_extractor/asr/asr_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
class AsrParser():
"""Provides parsing functions for navigating within an ARXML file.
"""
ns = {'ar': 'http://autosar.org/schema/r4.0'}

def __init__(self, arxml: str):
parser = etree.XMLParser(remove_blank_text=True)
self.__tree = etree.parse(arxml, parser)
self.__root = self.tree.getroot()

# get namespace from arxml file
AsrParser.ns = {'ar': self.__root.nsmap[None]}

self._packages = {
AsrParser.get_shortname(element): element
for element in self.find_all_elements('AUTOSAR/AR-PACKAGES/AR-PACKAGE')
Expand Down

0 comments on commit 2853112

Please sign in to comment.