1. XML (eXtensible Markup Language)

    Article: AN0002382Updated: 13.12.2018

    XML is a markup language determined mainly for data exchange between applications. XML document contains both data themselves and description of these data which are start and end characters (tags) surrounding the data.

    Example:

    <capitalcity>London</capitacity>

    Starting character, value and ending character constitute an element. The element can contain another element.

    There can be also attributes inside the elements. Attributes are contained in the starting tag.

    <lastdate format="dd.mm.yyyy">10.12.2018</lastdate>

    XML data are contained in:

    • names of tags and attributes - in the example above tag lastdate and attribute format
    • in attribute values - in the example above "dd.mm.yyyy"
    • as a text between tags - in the example above 10.12.2018

    There are various opinions on what should be included as an attribute value and what rather as a text between tags. There is only a technical constraint for the attribute value that cannot contain character of end of line (EOL).

    You can use all Unicode characters in XML.

    The principal XML property is its extensibility (eXtensible Markup Language). In contrast to HTML*), that contains predefined elements (e.g. title, div, h1, b, i, span) and the browser will not understand other elements, you can create your custom elements in XML and in this way develop your own markup language. Therefore, XML is a metalanguage, superior to languages that can be created by its means. We have used elements capitalcity and lastdate in the above example, that we have developed ourselves and actually extended the language in this way. If somebody should work with our language, he or she has to know how to use these elements. DTD (Document Type Definition) is used for that. It is a file with suffix dtd, that we should create and which contains all the elements and attributes that can be used. DTD is actually a template, according to which our XML document should be created. It contains all the elements and attributes that can be used. It determines possible combinations of these elements, whether they are mandatory, if they can be repeated etc.

    *) Note: The original HTML is not used today anymore. XHTML and HTML5 have taken its place as languages developed by applying XML rules.

    XML is a structured document with all tags creating a pair - start character and end character. Exception to this rule are tags with no content, e.g. tag end of line used by XHTML.

    <br/>

    No-pair tags end with characters />.

    XML itself does not solve data format. This is actually a big advantage because separation of the form from the content leads to a larger flexibility and enables customized data display for each application that works with the document. Having said that you can still enjoy a unified appearance and define it by means of CSS or XSL (eXtensible Stylesheet Language), that are linked to the document head. XSL allows you also to modify and transform the data. You can create an index or contents of XML document by means of XML and also convert it another formats (e.g. XHTML, PDF...). XSL standard contains XSL:FO (XSL Formatting Objects) dealing with formatting and XSLT (XSL Transformations) dealing with XML document transformation to another tree of objects.

    You can use several kinds of marking independently in a single document by means of namespaces. This allows to combine several DTD definitions or schemes in a single document without conflicts in element names.

    You can see XML in Objectgears e.g. in these cases:

    For more information consult Wikipedia and w3schools.

×