XML

XML represents a way to store data. Although somewhat verbose, an XML document is both human-readable and machine-readable. It can be regarded as something intermediate between a text file and a structured SQL table.

Whereas an SQL table is two-dimensional, an XML document is inherently hierarchical. While SQL operates at the server, XML is a client technology as much as a server technology. In general, SQL is best suited for highly dynamic data because of its storage efficiency, while XML is best suited for static content. Where significant advantages in retrieval efficiency, storage space, and security are required, SQL is more appropriate. XML data, however, can be easily prepared, transformed, and transported.

As an example, a Microsoft Word document (.docx) can be unzipped into a set of files, and XSLT can then be used to transform the resulting XML file into HTML. PDF files can likewise be converted to XML using the free online tool at https://onlineconvertfree.com/convert-format/pdf-to-xml/.

The following is an example of an XML document. Containing various tags and attributes, an XML document resembles an HTML document, except that the names of the XML tags and attributes are defined by the author.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<bookslist>
   <book id="123321">
      <title>Harry Potter</title>
      <author>J. K. Rowling</author>
      <ISBN>9780545010221</ISBN>
      <price>22.90</price>
      <bestseller/>
   </book>
   <book id="456654">
      <title>Fantasy in Death</title>
      <author>J. D. Robb</author>
      <ISBN>9781101185360</ISBN>
      <price>7.81</price>
   </book>
</bookslist>
A well-formed XML document must:

White space is preserved in XML, unlike in HTML, where it is truncated.

XML documents can be viewed directly in a browser. Dedicated XML editors such as Altova XMLSpy or OxygenXML are commonly used to process XML documents in various ways. A free Notepad++ plugin called XML Tools, available at http://sourceforge.net/projects/npp-plugins/files/XML%20Tools/, can be used to format XML documents, perform XSD validation, apply XSLT, and more.