ABAP Keyword Documentation → ABAP − Reference → Data Interfaces and Communication Interfaces → ABAP and XML → Transformations for XML → asXML - Canonical XML Representation
asXML - Mapping of XML Fragments
asXML allows whole XML fragments (elements together with their subelements) to be mapped that exist
in ABAP in XML format and that are the content of data objects or of parts of data objects (such as
structure components or table rows). The data objects must have the type xstring
and be declared with reference to the
domain XSDANY.
- When serialized, a data object of this type (or part of a data object) must contain the UTF-8 representation of a complete XML fragment. The content of the root element of the XML fragment is passed unmodified to the XML element for which the data object was created. If the name of the XML element is not the same as the name of the root element of the XML fragment, the fragment name is used as the content of an attribute asx:root that is assigned to the XML element. No attribute is created if the names are the same.
- When deserialized, an XML element that contains the attribute asx:root must be assigned to a data object (or part of a data object) of this type. An XML fragment is created in the data object that has the content of the attribute as a root element and whose content is inherited unmodified from the XML element. If the attribute asx:root does not exist, the root element is given the name of the XML element.
The following restrictions apply:
- XML fragments whose elements do not contain attributes cannot be deserialized.
- XML fragments whose root element is in the standard namespace cannot be serialized or deserialized.
Other versions: 7.31 | 7.40 | 7.54
Notes
- An XML fragment that exists in a data object of type
xstring
and that is not declared with reference to the domain XSDANY is formatted as the XML schema type xsd:base64Binary in accordance with the rules for mapping elementary data types.
- An XML element that contains the attribute asx:root cannot be deserialized to data objects that are not declared with reference to the domain XSDANY.
- The handling of XML fragments in the statement tt:value is supported in simple transformations, but not in the statements tt:write or tt:read. In tt:value, the mapping rule for XML fragments can be modified using certain values for the attribute option.
- XML fragments in byte strings with reference to the domain XSDANY are not supported in transformations for JSON.