October 2002
Intermediate to advanced
400 pages
9h 40m
English
Now that you’ve got a good understanding of what it means to parse an XML document, let’s take a look at a short example that uses one of the tools that were just discussed. For this example, we’ll use the XML::Parser Perl module to parse a small XML document. Listing 2.1 shows a small XML document that contains statistics from two great baseball players. As you can see, the XML document is very simple. It has two <player> elements, and each <player> element has four child elements (<name>, <team>, <home_runs>, and <batting_average>). Granted, this is a small and simple XML document, but it is perfect for illustrating simple XML parsing. Our goal for this example is to parse this document ...