Skip to main content

XML

XML (Extensible Markup Language) is a markup language that was released by the World Wide Web Consortium (W3C) in 1998. It allows users to create their own tags to “mark up” (i.e., describe) documents. XML documents can be easily read by both humans and machines. Since XML stores data in a plain text format, it is software- and hardware-independent, making it useful for data sharing. XML also supports Unicode, which means that it can be used to transmit information in most languages.

XML uses elements to create the structure of XML documents. Elements typically describe what something is. Each element has an opening tag (e.g., <title>) and a closing tag (e.g., </title>), unless the element is self-closing (e.g., <lb/>). All XML documents are formed as “element trees” which begin at a root element that contains all the other elements. By nesting elements, encoders can create parent-child and sibling-sibling relationships. Attributes can be added to elements to add supplemental information and values are used to specify attributes.

Examples

  • The following example shows a basic XML tree where the element <person> has been specified by the attribute @type and the value "author".

<person type="author">Margaret Laurence</person>

  • The following example shows a basic XML tree where <person> is the parent of <persName> and <persName> is the child of <person>. The elements <reg>, <forename>, and <surname> are all the children of <persName> and <reg>, <forename>, and <surname> are siblings of each other.
<person>
<persName>
<reg>Margaret Laurence</reg>
<forename>Margaret</forename>
<surname>Laurence</surname>
</persName>
</person>

Further Resources