sapdev logo background
sapdev logo sapdev logo
Comments

SAP XML OVIEW documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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.
<(><<)>tag>
...
/tag
A short way of writing an empty element tag /tag is
tag /
. Elements can be nested inside other elements to any depth. A subelement can be specified more than once within an element.
<(><<)>tag>
<(><<)>tag1>
<(><<)>tag2>
...
<(><<)>/tag2>
<(><<)>/tag1>
<(><<)>tag1>
...
<(><<)>/tag1>
...
/tag
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:
tag attribute="..."
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 .
... xmlns:ns="..."
Prefixing a tag or attribute with a namespace prefix ns separated by a colon : gives the tag or element a qualified name:
<(><<)>tag xmlns:ns="...">
<(><<)>ns:tag ns:attribute="...">
...
<(><<)>/ns:tag>
...
/tag
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:
Character XML Notation
lt;
gt;
amp;amp;
" in attributes delimited by " quot;
' in attributes delimited by ' apos;
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.

Notes
  • 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.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    XML_GLOSRY
    XML_READER_GLOSRY




    comments powered by Disqus