Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
XML permits document authors to create markup (i.e., a text-based notation for describing data) for virtually any type of information, enabling them to create entirely new markup languages for describing any type of data, such as mathematical formulas, software-configuration instructions, chemical molecular structures, music, news, recipes and financial reports. XML describes data in a way that human beings can understand and computers can process.
Figure 15.1 is a simple XML document that describes information for a baseball player. We focus on lines 5ā9 to introduce basic XML syntax. Youāll learn about the other elements of this document in Section 15.3.
Ā 1Ā Ā Ā <?xml version = "1.0"?>
Ā 2
Ā 3Ā Ā Ā <!-- Fig. 15.1: player.xml -->
Ā 4Ā Ā Ā <!-- Baseball player structured with XML -->
Ā 5Ā Ā Ā <player>
Ā 6Ā Ā Ā Ā Ā Ā <firstName>John</firstName>
Ā 7Ā Ā Ā Ā Ā Ā <lastName>Doe</lastName>
Ā 8Ā Ā Ā Ā Ā Ā <battingAverage>0.375</battingAverage>
Ā 9Ā Ā Ā </player>