Return To Web Portfolio >

XML With Perl: XML Source

Partial example of the XML source file used.


<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="amazon.xsl" ?>
<!DOCTYPE amazon SYSTEM "amazon.dtd">
<amazon>
    <subjects>
        <subject value="BYRON" fullname="George Gordon, Lord Byron">
         <item type="book" asin="0312051247">
          <title>The Love Poems of Lord Byron : A Romantic\'s Passion</title>
          <image width="34" height="50"/>
          <comments>An illustrated collection of 43 love poems which has received favorable reviews.</comments>
         </item>
         <item type="audio" asin="1565113004">
          <title>Lord Byron Poems</title>
          <image width="31" height="50"/>
          <comments>Includes a commentary with historical and biographical context for each poem.</comments>
         </item>
        </subject>
        <subject value="DICKINSON" fullname="Emily Dickinson">
         <item type="book" asin="0674250702">
          <title>Emily Dickinson : Selected Letters</title>
          <image width="32" height="50"/>
          <comments>Dickinson's own letters reveal the woman behind the writer.</comments>
         </item>
        </subject>
    </subjects>
</amazon>

Part of the DTD (Document Type Definition) for this XML file:


<!ELEMENT amazon (subjects, icons)>

    <!ELEMENT subjects (subject+)>

        <!ELEMENT subject (item+)>
            <!ATTLIST subject
              value CDATA #REQUIRED
              fullname CDATA #REQUIRED
            >

            <!ELEMENT item (title, image?, comments?)>
                <!ATTLIST item
                  type (book|cd|video|audio) "book"
                  asin CDATA #REQUIRED
                >
        
                <!ELEMENT title (#PCDATA)>
                <!ELEMENT image EMPTY>
                    <!ATTLIST image 
                      url CDATA #IMPLIED
                      link CDATA #IMPLIED
                      width CDATA #IMPLIED
                      height CDATA #IMPLIED
                      border CDATA "0"
                      text CDATA ""
                      align CDATA #IMPLIED
                    >
                 <!ELEMENT comments (#PCDATA)>
                
    <!ELEMENT icons (icon)*>

        <!ELEMENT icon EMPTY>
            <!ATTLIST icon 
              name CDATA #REQUIRED
              url CDATA #REQUIRED
              link CDATA #IMPLIED
              width CDATA #IMPLIED
              height CDATA #IMPLIED
              border CDATA "0"
              text CDATA ""
              align CDATA "left"
            >


Return To Web Portfolio >