Appendix A. The Eight-Minute XML Tutorial

One of the most impressive features of XML (eXtensible Markup Language) is how little you need to know to get started. This appendix gives you some of the key pieces of information you’ll need. The references at the end of Chapter 6 point you to many excellent resources that you can turn to for more information.

XML Is a Markup Language

Thanks to the ubiquity of XML’s older and stodgier cousin, HTML, almost everyone is familiar with the notion of a markup language. Like HTML, XML consists of plain text interspersed with little bits of special descriptive or instructive text. HTML has a rigid definition for which bits of markup text, called tags, are allowed, while XML allows you to make up your own.

Consequently, XML provides a range of expression far beyond that of HTML. One example of this range of expression is found in Chapter 6, but here’s another simple example that you should find easy to read even if you don’t have any prior XML experience:

<hosts>
  <machine>
    <name> quiddish </name>
    <department> Software Sorcery </department>
    <room> 314WVH </room>
    <owner> Horry Patter </owner>
    <ipaddress> 192.168.1.13 </ipaddress>
  </machine>
  <machine>
    <name> dibby </name>
    <department> Hardware Hackery </department>
    <room> 310WVH </room>
    <owner> Harminone Grenger </owner>
    <ipaddress> 192.168.1.15 </ipaddress>
  </machine>
</hosts>

XML Is Picky

Despite XML’s flexibility, it is pickier in places than HTML. There are syntax and grammar rules that your data must ...

Get Automating System Administration with Perl, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.