XML

Updated: 11/13/2018 by Computer Hope
XML icon

Short for extensible markup language, XML is a specification developed by W3C starting with the recommendation on February 10, 1998. XML is similar to HTML in that XML uses tags to markup a document, allowing the browser to interpret and display the information. However, unlike HTML, XML language is unlimited (extensible). It allows tags to define themselves, and can describe the content instead of only displaying a page's content. Using XML other languages such as RSS and MathML were created, even tools like XSLT (extensible stylesheet language transformations) were created using XML.

Example of XML code

Below is a basic example of how XML code may appear. As mentioned earlier, use whatever tags you want to use as long as they follow all the rules. Also, because there are no defined rules or structure, a DTD (document type definition) needs to be defined with instructions and structure of your XML.

<?xml version="1.0" encoding="utf-8"?>
<computersoftware>
<product>
<name>Windows 8</name>
<description>Microsoft Windows 8 operating system - Full version.</description> <developer>Microsoft</developer> <cost>132.78</cost>
</product>
<product>
<name>World of Warcraft</name>
<description>World of Warcraft for Mac and PC.</description>
<developer>Blizzard</developer>
<cost>10.99</cost>
</product>
</computersoftware>

How do you create XML?

Like HTML, XML can be created using any text editor. However, it's easier to create using an HTML editor with XML syntax highlighting like Dreamweaver or a text editor with syntax highlighting like Notepad++.

Rules to remember when creating XML

Although the XML language is unlimited regarding defining tags, there are still rules that need to be followed when writing XML code.

  • All XML opening tags must have a matching closing tag. If you have an empty tag, use a tag similar to <example/>.
  • XML tags are case-sensitive, so your opening tag should exactly match the closing tag.
  • You must have a single root tag (element) with all other tags. In our example, "computersoftware" was our root tag.
  • All tags containing an attribute must be in quotes.
  • All tags must be properly nested.

Does XML replace HTML?

No. HTML is still the primary language used to create the structure of a web page. XML can be used in addition to an HTML page or as an alternative to HTML.

API, Computer acronyms, Database terms, HTML, Internet terms, Markup, Metalanguage, Programming language, Programming terms, RSS, SOAP, Tag, Web design terms, WML, XHTML, XSL