XML, the Perl Way

Processing XML with Perl Michel Rodriguez

XML introduction

The XML syntax

Example of an XML document

Here is an example of a document that we will use throughout the tutorial:

<?xml version="1.0"?>
<!DOCTYPE catalog SYSTEM "catalog.dtd" []>
<catalog>
<class name="red">
  <category name="bordeaux">
    <item>
      <winery>Ginestet</winery>
      <type>Marquis de Chasse Reserve</type>
      <year>1997</year>
      <rating>9</rating>
      <stock>100</stock>
      <price currency="$">10</price>
    </item>
    <item>
      <winery>Chateau Lafon-Rochet</winery>
      <type aoc="Grand Cru Classe">Saint-Estephe</type>
      <year>1997</year>
      <rating>9</rating>
      <stock>0</stock>
      <price currency="$">25</price>
   </item> 
  </category>
  <category name="navarra">
    <item>
      <winery>Bodegas Julian Chivite</winery>
      <type>Navarra Gran Feudo Crianza</type>
      <year>1996</year>
      <rating>9</rating>
      <stock>100</stock>
      <price currency="$">10</price>
    </item>
  </category>
</class>
</catalog>


XML introduction

The XML syntax