1 introduction to xml – TANDBERG MPS API Interface D13639 User Manual

Page 4

Advertising
background image

TANDBERG MPS API

User Guide

2

1.1 Introduction to XML


XML is a markup language for documents containing structured information.

All information elements in an XML document are marked by a tag and a corresponding end-
tag. The end-tag has the same name as the tag, but is prefixed with a slash, “/”. All tags are
put within angular brackets (“< >”).


Example 1.1

Below is an example of how configurations of a Serial Port could be represented using XML.

<Configuration>
<SerialPort item="1">
<BaudRate item="1">9600</BaudRate>
<Parity item="1">None</Parity>
<DataBits item="1">8</DataBits>
<StopBits item="1">1</StopBits>
<Mode item="1">Control</Mode>
</SerialPort>
</Configuration>



From the tree structure of this example we can see that BaudRate, Parity, Databits,
StopBits

and Mode are properties of the SerialPort. We can distinguish between

container-elements and value-elements. Container-elements contain one or more sub-
elements, while value-elements contain a value. This is analogous to files and folders on a
computer. Container-elements are folders that can contain sub-folders and files, while value-
elements are files containing data.
In the XML structure for the Serial Port we see that the container-element SerialPort
contains five sub-elements. All these sub-elements are value-elements, each holding values
for the properties: BaudRate, Parity, DataBits, StopBits and Mode.


Example 1.2

In this example we will look at element attributes. Attributes are used to add meta information
to an element. Attributes are placed within the start tag of an element and different attributes
are separated by space.

An XML structure representing the status of a call in a videoconferencing system is shown
below:

<Status>
<Call item="1" status="Disconnected" type="NA" protocol="NA">
<Cause item="1">255</Cause>
</Call>
</Status>


We can see from the status attribute of the Call element that the call is disconnected. The
only relevant information regarding this call is the disconnect cause value. Therefore the sub-
structure of the call element contains only one value-element.

Advertising