XML - Short Overview
XML (Extensible Markup Language) is used to represent data structured in different ways. This makes it very useful for communications between different applications and for the integration of data from different applications.
XML data comprises metadata (markups) in the form of tags and the actual data in the form of elements. XML does not specify a fixed set of tags.
In XML 1.0 format, tags are wrapped in pointy brackets and always appear in pairs, with <tag> marking the start of an element and </tag> the end of an element.
A short way of writing an empty element <tag></tag> is
. Elements can be nested inside other elements to any depth. A subelement can be specified more than once within an element.
Valid XML data contains exactly one root element, in which all other elements are nested.
Alongside subelements, attributes are allowed. These are defined in the opening tag of an element:
The attributes of an element are specified as name-value pairs using the equals sign = before the closing bracket and do not themselves contain markups. Attributes can be delimited using double quotation marks, ", and single quotation marks, '. An attribute can only be specified once within an element. The order in which the attributes are specified is not important.
To stop naming conflicts occurring when XML data from different sources is processed, tags can be given namespaces. Special xmlns attributes are used to declare namespaces. A uniform resource identifier (URI) is attached to a namespace prefix ns.
Prefixing a tag or attribute with a namespace prefix ns separated by a colon : gives the tag or element a qualified name:
A namespace prefix must be defined in the same document before it is used.
Characters that have a separate meaning in XML syntax need to be escaped if they appear in values of elements or attributes:
|" in attributes delimited by "||"|
|' in attributes delimited by '||'|
XML data is valid (well-formed) if it does not break any XML rules. Generally speaking, XML data must be well-formed before it can be processed by an XML parser.
7.31 | 7.40 | 7.54
- The XML 1.0 format shown here (character strings in pointy brackets) is only one way of representing XML data, although it is the most widely used. A W3C recommendation states that the tree-like arrangement of data in information sets defines the XML format. Any data structured in this way can be handled as XML data. Other notations can also be used, not just XML 1.0. For example, SAP's own Binary XML uses a binary format instead of character strings and does not delimit tags with pointy brackets. ABAP supports further formats alongside XML 1.0 thanks to sXML Library.
- The program DEMO_XML_SYNTAX_CHECK enables XML data to be entered and its syntax checked.