AUTOSAR FO TPS ARXMLSerializationRules
AUTOSAR FO TPS ARXMLSerializationRules
AUTOSAR FO R23-11
Disclaimer
This work (specification and/or software implementation) and the material contained in
it, as released by AUTOSAR, is for the purpose of information only. AUTOSAR and the
companies that have contributed to it shall not be liable for any use of the work.
The material contained in this work is protected by copyright and other types of intel-
lectual property rights. The commercial exploitation of the material contained in this
work requires a license to such intellectual property rights.
This work may be utilized or reproduced without any modification, in any form or by
any means, for informational purposes only. For any other purpose, no part of the work
may be utilized or reproduced, in any form or by any means, without permission in
writing from the publisher.
The work has been developed for automotive applications only. It has neither been
developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Contents
1 Introduction 6
1.1 Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 ARXML Serialization Rules 9
2.1 Physical Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.1 File separation . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.2 File names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.1 XML Character Encoding . . . . . . . . . . . . . . . . . . . . . 9
2.2.2 XML Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2.3 XML Comments and Processing Instructions . . . . . . . . . . 10
2.2.4 XML Root Element . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.5 XML Formating / Indention . . . . . . . . . . . . . . . . . . . . 13
3 Glossary 18
References
[1] AUTOSAR XML Schema Production Rules
AUTOSAR_FO_TPS_XMLSchemaProductionRules
[2] Software Component Template
AUTOSAR_CP_TPS_SoftwareComponentTemplate
[3] System Template
AUTOSAR_CP_TPS_SystemTemplate
[4] Specification of ECU Configuration
AUTOSAR_CP_TPS_ECUConfiguration
[5] Meta Model
AUTOSAR_FO_MMOD_MetaModel
[6] Meta Model-generated XML Schema
AUTOSAR_FO_MMOD_XMLSchema
[7] Standardization Template
AUTOSAR_FO_TPS_StandardizationTemplate
[8] Extensible Markup Language (XML), v1.0
http://www.w3.org/TR/REC-xml/
[9] XML Schema 1.0
http://www.w3.org/TR/xmlschema-1
[10] Generic Structure Template
AUTOSAR_FO_TPS_GenericStructureTemplate
[11] Unified Modeling Language:Superstructure, Version 2.0, OMG Available Specifi-
cation, ptc/05-07-04
http://www.omg.org/cgi-bin/apps/doc?formal/05-07-04
[12] Software Process Engineering Meta-Model Specification
http://www.omg.org/spec/SPEM/2.0/
1 Introduction
This document specifies rules on how AUTOSAR models are serialized into AUTOSAR
XML descriptions. The intention of this specification is to support the interoperability
between AUTOSAR tools by specifying additional constraints on the AUTOSAR XML
descriptions that go beyond the definition of the XML structure that is defined by the
AUTOSAR XML schema. Benefits include:
• Comparison of AUTOSAR XML descriptions is simplified by defining a normalized
representation that avoids meaningless differences such as indention, character
encoding.
• Effort for tool implementation is reduced by restricting the amount of different fla-
vors of XML. E.g. different namespace prefixes, character encoding, files names,
etc.
AUTOSAR template specifications define the AUTOSAR Data Exchange Format. Fig-
ure 1.1 shows the relationship between the AUTOSAR ARXML Serialization Rules (this
specification) and other template specifications:
• The AUTOSAR XML Schema Production Rules [1] and this document focus on
the physical representation and the XML data format.
• The Software Component Template [2], System Template [3], ECU Configuration
Template [4], etc. address the data structure and its semantics.
Physical Representation and XML Data Format (General File System and XML Processing)
AUTOSAR formalizes and maintains the data structure and semantics of the
AUTOSAR Data Exchange Format in the AUTOSAR Meta Model [5]. The mapping be-
tween that meta model and the AUTOSAR XML Schema [6] is described in AUTOSAR
XML Schema Production Rules [1] (see figure 1.2).
An AUTOSAR Tool that produces an AUTOSAR XML Description has to serialize the
AUTOSAR model in a way that it validates successfully against the AUTOSAR XML
Schema. Additional constraints that go beyond XML Schema validation are described
in this document.
InstanceOf InstanceOf
Figure 1.2: Relationship between XML Schema Production Rules and ARXML Serializa-
tion Rules
The points in the workflow where constraints shall be enforced, sometimes also known
as the "binding time" of the constraint, are different for each model category, e.g. on the
classic platform, the constraints defined for software-components are typically enforced
prior to the generation of the RTE while the constraints against the definition of an Ecu
extract shall be applied when the Ecu configuration for the Com stack is created.
For each document, possible binding times of constraints are defined and the binding
times are typically mentioned in the constraint themselves to give a proper orientation
for implementers of AUTOSAR authoring tools.
Let AUTOSAR be an example of a typical class table. The first rows in the table have
the following meaning:
Class: The name of the class as defined in the UML model.
Package: The UML package the class is defined in. This is only listed to help locating
the class in the overall meta model.
Note: The comment the modeler gave for the class (class note). Stereotypes and UML
tags of the class are also denoted here.
Base Classes: If applicable, the list of direct base classes.
The headers in the table have the following meaning:
Attribute: The name of an attribute of the class. Note that AUTOSAR does not distin-
guish between class attributes and owned association ends.
Type: The type of an attribute of the class.
Mul.: The assigned multiplicity of the attribute, i.e. how many instances of the given
data type are associated with the attribute.
Kind: Specifies, whether the attribute is aggregated in the class (aggr aggregation),
an UML attribute in the class (attr primitive attribute), or just referenced by it (ref
reference). Instance references are also indicated (iref instance reference) in this
field.
Note: The comment the modeler gave for the class attribute (role note). Stereotypes
and UML tags of the class are also denoted here.
Please note that the chapters that start with a letter instead of a numerical value rep-
resent the appendix of the document. The purpose of the appendix is to support the
explanation of certain aspects of the document and does not represent binding con-
ventions of the standard.
The verbal forms for the expression of obligation specified in [TPS_STDT_00053] shall
be used to indicate requirements, see Standardization Template, chapter Support for
Traceability ([7]).
The representation of requirements in AUTOSAR documents follows the table specified
in [TPS_STDT_00078], see Standardization Template, chapter Support for Traceability
([7]).
Example 2.1
Some files could contain data types others could contain interfaces, etc.
Example 2.2
[TPS_ASR_00006] Avoid UTF BOM dAUTOSAR XML descriptions should NOT start
with a "UTF Byte Order Mask" (BOM).c()
The byte order mask is a Unicode character that can be used at the start of a text
stream in order to communicate information about:
• The fact that the stream is encoded in Unicode
• Which Unicode encoding is used (UTF-8, UTF-16, ...)
• The endianness of the Unicode encoding
According to [TPS_ASR_00004] and [TPS_ASR_00005] the character encoding of
AUTOSAR XML descriptions shall be UTF-8 and this information shall be explicitly
described in the XML declaration.
UTF-8 is agnostic of the endianness. Thus, using a BOM does not add additional
information.
Example 2.3
1
The only exception from this rule is the declaration of the XML version and the XML character
encoding. These processing instructions shall be supported as required by [TPS_ASR_00005] and
[TPS_ASR_00008]
xsi:schemaLocation="http://autosar.org/schema/r4.0 AUTOSAR_4-3-0.xsd"
With the advent of the AUTOSAR adaptive platform, AUTOSAR decided to implement
a different versioning scheme for the releases of the adaptive platform (the classic
platform would just keep the existing approach to versioning).
This new version scheme for the adaptive platform consists of just two elements, the
year and month of release.
The original approach was to simply use the two-element scheme of the adaptive re-
leases also for the definition of the xsi:schemaLocation for ARXML files containing
models for the adaptive platform.
xsi:schemaLocation="http://autosar.org/schema/r4.0 AUTOSAR_2017-03.xsd"
Over time, this approach would have created a hard-to-disentangle history of three-
element and two-element values for xsi:schemaLocation and it would have been
hard to guess which releases of the AUTOSAR XML Schema were actually backwards-
compatible to a given ARXML file.
In order to mitigate the problem, AUTOSAR also decided to invent a completely new
versioning scheme for the schema releases, independent of whether the individual
schema release would be triggered by the AUTOSAR classic platform or the AUTOSAR
adaptive platform.
The new versioning scheme for being used in the xsi:schemaLocation foresees the
existence of just one element, a positive number that is increased with every AUTOSAR
release, whether the release focuses on the classic or adaptive platform does not mat-
ter.
xsi:schemaLocation="http://autosar.org/schema/r4.0 AUTOSAR_00044.xsd"
The namespace is kept across multiple releases of the AUTOSAR XML Schema as
long as backward compatibility is kept. <major> and <minor> are the major and mi-
nor version numbers of the AUTOSAR release that starts a sequence of backwards
compatible AUTOSAR XML Schema.c()
Example 2.4
Example 2.5
This approach allows the validation of AUTOSAR XML descriptions against newer
AUTOSAR XML Schema as long as the AUTOSAR XML Schema is backwards com-
patible.
Additionally, the tool can try to validate the AUTOSAR XML description against an
older AUTOSAR XML Schema as long as the AUTOSAR XML description does not
use newer features.
Example 2.6
<AUTOSAR ...
xsi:schemaLocation="http://autosar.org/schema/r4.0 AUTOSAR_4-3-0.xsd>
</AUTOSAR>
[TPS_ASR_00013] Pattern for AUTOSAR XML Schema location hint URI dThe
AUTOSAR XML Schema location hint URI in the AUTOSAR XML description
shall be the file name of a XML Schema document provided by AUTOSAR. This file
name follows the pattern:
AUTOSAR_{number}.xsd
{number} corresponds to the specific AUTOSAR release the given AUTOSAR XML
Schema belongs to.
In particular no path shall be part of the AUTOSAR XML Schema location hint
URI.c()
The formating and indention that is specified in this section does not change the se-
mantics of the AUTOSAR model.
The main purpose is the reduction of meaningless differences when comparing two
AUTOSAR XML descriptions using textual diff tools. The XML description should be
formatted as shown in [TPS_ASR_00019].
<L-1 L="EN">This
is <E>bold</E> style </L-1>
c()
The following example 2.1 illustrates these approaches:
<UNIT>
<SHORT-NAME>Perc</SHORT-NAME> <!-- OneLine -->
<DESC> <!-- NewLine -->
<L-2 L="EN">a percentage...</L-2> <!-- OneLine -->
</DESC>
<DISPLAY-NAME>%</DISPLAY-NAME> <!-- OneLine -->
</UNIT>
<UNIT>
<SHORT-NAME>PercPerSec</SHORT-NAME> <!-- OneLine -->
<DESC> <!-- NewLine -->
<L-2 L="EN">time-derivative of percent</L-2> <!-- NewLine
NormalizeWhitespace
-->
</DESC>
<DISPLAY-NAME>%/s</DISPLAY-NAME> <!-- OneLine -->
</UNIT>
Listing 2.1: Serialization Example
Example 2.7
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_00052.xsd">
<!-- .... -->
</AUTOSAR>
Listing 2.2: Valid example for hierarchy
The AUTOSAR meta model explicitly defines if the order of elements that are owned
by an attribute is relevant. The order of an attribute is relevant if
• the attribute is owned by a mixed content class (a class with stereotype «atp-
Mixed» or «atpMixedString» as defined by [TPS_GST_00024], [TPS_GST_-
00025], [TPS_GST_00032] in [10]) or
• the attribute with upper multiplicity > 1 is flagged as {ordered} according to the
UML specification [11].
Tools shall not change the order of elements whose order is semantically relevant.
However, if the order of elements is not relevant, then a tool may serialize the elements
in an arbitrary order.
This often results in meaningless differences when comparing AUTOSAR XML de-
scriptions using textual diff tools. In order to reduce those meaningless differences the
following rules should apply.
[TPS_ASR_00014] Sorting elements if their order is semantically meaningless d
Attributes with upper multiplicity greater than 1 whose order of elements is semantically
meaningless (i.e. the collection is not qualified as {ordered} and not owned by a
class with stereotype atpMixed or atpMixedString) should be serialized
using the following heuristics:
1. If the AUTOSAR meta model decorates the aggregation or reference with stereo-
type atpSplitable, then the contained elements shall be sorted alphabet-
ically in ascending order using a key that is calculated according to the expression
mentioned in the generated atp.Splitkey.
If, for example, the tag atp.Splitkey is set to the value “shortName,-
variationPoint.shortLabel”, then the elements shall be sorted by a sort-
ing key that is calculated out of the concatenation of the values of the OCL ex-
pressions in the atp.Splitkey:
3 Glossary
Artifact This is a Work Product Definition that provides a description and definition for
tangible work product types. Artifacts may be composed of other artifacts ([12]).
At a high level, an artifact is represented as a single conceptual file.
AUTOSAR Tool This is a software tool which supports one or more tasks defined as
AUTOSAR tasks in the methodology. Depending on the supported tasks, an
AUTOSAR tool can act as an authoring tool, a converter tool, a processor tool or
as a combination of those (see separate definitions).
AUTOSAR Authoring Tool An AUTOSAR Tool used to create and modify AUTOSAR
XML Descriptions. Example: System Description Editor.
AUTOSAR Converter Tool An AUTOSAR Tool used to create AUTOSAR XML files by
converting information from other AUTOSAR XML files. Example: ECU Flattener
AUTOSAR Definition This is the definition of parameters which can have values. One
could say that the parameter values are Instances of the definitions. But in the
meta model hierarchy of AUTOSAR, definitions are also instances of the meta
model and therefore considered as a description. Examples for AUTOSAR def-
initions are: EcucParameterDef, PostBuildVariantCriterion, SwSys-
temconst.
AUTOSAR XML Description In AUTOSAR this means "filled Template". In fact an
AUTOSAR XML description is the XML representation of an AUTOSAR model.
The AUTOSAR XML description can consist of several files. Each individual file
represents an AUTOSAR partial model and shall validate successfully against the
AUTOSAR XML schema.
AUTOSAR Meta-Model This is an UML2.0 model that defines the language for de-
scribing AUTOSAR systems. The AUTOSAR meta-model is an UML represen-
tation of the AUTOSAR templates. UML2.0 class diagrams are used to describe
the attributes and their interrelationships. Stereotypes, UML tags and OCL ex-
pressions (object constraint language) are used for defining specific semantics
and constraints.
AUTOSAR Meta-Model Tool The AUTOSAR Meta-Model Tool is the tool that gener-
ates different views (class tables, list of constraints, diagrams, XML Schema etc.)
on the AUTOSAR meta-model.
AUTOSAR Model This is a representation of an AUTOSAR product. The AUTOSAR
model represents aspects suitable to the intended use according to the
AUTOSAR methodology.
Strictly speaking, this is an instance of the AUTOSAR meta-model. The infor-
mation contained in the AUTOSAR model can be anything that is representable
according to the AUTOSAR meta-model.
Profile Authoring Support Data Data that is used for efficient authoring of a profile.
E.g. list of referable constraints, meta-classes, meta-attributes or other reusable
model assets (blueprints)
Profile Authoring Tool A specialized AUTOSAR Tool which focuses on the authoring
of profiles for data exchange points. It e.g. provides support for the creation of
profiles from scratch, modification of existing profiles or composition of existing
profiles.
Profile Compatibility Checker Tool A specialized AUTOSAR Tool which focuses on
checking the compatibility of profiles for data exchange. Note that this compat-
ibility check includes manual compatibility checks by engineers and automated
assistance using more formal algorithms.
Profile Consistency Checker Tool A specialized AUTOSAR Tool which focuses on
checking the consistency of profiles.
Property A property is a structural feature of an object. As an example a “connector”
has the properties “receive port” and “send port”
Properties are made variant by the atpVariation.
Prototype This is the implementation of a role of a type within the definition of another
type. In other words a type may contain Prototypes that in turn are typed by
"Types". Each one of these prototypes becomes an instance when this type is
instantiated.
Type A type provides features that can appear in various roles of this type.
Value This is a particular value assigned to a “Definition”.
Variability Variability of a system is its quality to describe a set of variants. These
variants are characterized by variant specific property settings and / or selections.
As an example, such a system property selection manifests itself in a particular
“receive port” for a connection.
This is implemented using the atpVariation.
Variant A system variant is a concrete realization of a system, so that all its proper-
ties have been set respectively selected. The software system has no variability
anymore with respect to the binding time.
This is implemented using EvaluatedVariantSet.
Variation Binding A variant is the result of a variation binding process that resolves
the variability of the system by assigning particular values/selections to all the
system’s properties.
This is implemented by VariationPoint.
Variation Binding Time The variation binding time determines the step in the method-
ology at which the variability given by a set of variable properties is resolved.
4
Subset of:
[TR_IOAT_00062] Authoring tool SHALL
[TPS_ASR_00012] AUTOSAR Revision Declaration
support well defined serialization (incl.
explanatory text)
Subset of:
Pattern for AUTOSAR Revision [TR_IOAT_00062] Authoring tool SHALL
[TPS_ASR_00013]
Hint URI support well defined serialization (incl.
explanatory text)
Subset of:
[TR_IOAT_00062] Authoring tool SHALL
[TPS_ASR_00014] Order of Elements
support well defined serialization (incl.
explanatory text)
Subset of:
Empty elements represented by [TR_IOAT_00062] Authoring tool SHALL
[TPS_ASR_00015]
start-end tag pairs support well defined serialization (incl.
explanatory text)
Replaces: [TR_IOAT_00075] No empty
[TPS_ASR_00016] No empty wrappers
wrappers
Replaces: [TR_IOAT_00075] No empty
[TPS_ASR_00017] No empty wrappers
wrappers
No Third-Party XML Subset of:
[TPS_ASR_00018]
Namespaces [1] chapter “XML description production”
Subset of:
Formating of AUTOSAR XML [TR_IOAT_00062] Authoring tool SHALL
[TPS_ASR_00019]
Descriptions support well defined serialization (incl.
explanatory text)
Table A.1: Changed Specification Items in 4.3.0
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
none
Number Heading
[TPS_ASR_00014] Sorting elements if their order is semantically meaningless
Table A.2: Changed Specification Items in R22-11
none
none
none
none
none
Number Heading
[TPS_ASR_00019] Formating of AUTOSAR XML Descriptions
Table A.3: Changed Specification Items in R23-11
none
none
none
none
none
none
none
Primitive Ref
Package M2::AUTOSARTemplates::GenericStructure::GeneralTemplateClasses::PrimitiveTypes
Note This primitive denotes a name based reference. For detailed syntax see the xsd.pattern.
• first slash (relative or absolute reference) [optional]
• Identifier [required]
• a sequence of slashes and Identifiers [optional]
This primitive is used by the meta-model tools to create the references.
Tags:
xml.xsd.customType=REF
xml.xsd.pattern=/?[a-zA-Z][a-zA-Z0-9_]{0,127}(/[a-zA-Z][a-zA-Z0-9_]{0,127})*
xml.xsd.type=string
Attribute Type Mult. Kind Note
base Identifier 0..1 attr This attribute reflects the base to be used for this
reference.
Tags: xml.attribute=true
blueprintValue String 0..1 attr This represents a description that documents how the
value shall be defined when deriving objects from the
blueprint.
Tags:
atp.Status=draft
xml.attribute=true
index PositiveInteger 0..1 attr This attribute supports the use case to point on specific
elements in an array. This is in particular required if
arrays are used to implement particular data objects.
The counting of array indices starts with the value 0, i.e.
the index of the first array element is 0.
Tags: xml.attribute=true
Primitive VerbatimString
Package M2::AUTOSARTemplates::GenericStructure::GeneralTemplateClasses::PrimitiveTypes
Note This primitive represents a string in which white-space needs to be preserved.
Tags:
xml.xsd.customType=VERBATIM-STRING
xml.xsd.type=string
xml.xsd.whiteSpace=preserve
Attribute Type Mult. Kind Note
blueprintValue String 0..1 attr This represents a description that documents how the
value shall be defined when deriving objects from the
blueprint.
Tags:
atp.Status=draft
xml.attribute=true
xmlSpace XmlSpaceEnum 0..1 attr This attribute is used to signal an intention that in that
element, white space should be preserved by
applications. It is defined according to xml:space as
declared by W3C.
Tags:
xml.attribute=true
xml.attributeRef=true
xml.name=space
xml.nsPrefix=xml
Table B.5: VerbatimString