<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by ABREX Ver. 1.1.0 -->
<AUTOSAR xmlns="http://autosar.org/schema/r4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://autosar.org/schema/r4.0 AUTOSAR_4-0-3_STRICT.xsd">
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>Ecuc</SHORT-NAME>
<ELEMENTS>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>Os</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/AUTOSAR/EcucDefs/Os</DEFINITION-REF>
<ECUC-DEF-EDITION>4.2.0</ECUC-DEF-EDITION>
<IMPLEMENTATION-CONFIG-VARIANT>VARIANT-PRE-COMPILE</IMPLEMENTATION-CONFIG-VARIANT>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>OsInclude</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/AUTOSAR/EcucDefs/Os/OsInclude</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-TEXTUAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-STRING-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsInclude/OsIncludeFileName</DEFINITION-REF>
<VALUE>sample1.h</VALUE>
</ECUC-TEXTUAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>AppMode1</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/AUTOSAR/EcucDefs/Os/OsAppMode</DEFINITION-REF>
</ECUC-CONTAINER-VALUE>
</ECUC-MODULE-CONFIGURATION-VALUES>
</ELEMENTS>
</AR-PACKAGE>
</AR-PACKAGES>
</AUTOSAR>
I tried this code but failed to do it. This is my code. I want to find the value of the Tag from DEFINITION-REF
, which is DEST=ECUC-ENUMERATION-PARAM-DEF
. But I am not able to get the value of DEST
. when I run the below code, I got this error
self._root = parser._parse_whole(source) xml.etree.ElementTree.ParseError: XML or text declaration not at start of entity: line 3, column 0 "
import xml.etree.ElementTree as ET
root = ET.parse('sudh.arxml').getroot()
#run this, and it will list the key value pairs for DEFINITION-REF element :
for entry in root.findall(".//{http://autosar.org/schema/r4.0}DEFINITION-REF"):
print(entry.attrib)