XML-Dokument

Quellcode

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE shop SYSTEM "order2.dtd">
<shop>
     <customer>
          <name>Timo</name>
          <surname>Schaefer</surname>
          <address>
                  Hallhuettenweg 20
                  63322 Roedermark
                  Germany
          </address>
          <e-mail>schaefer@media-art.net</e-mail>
          <date>01.01.2001</date>
     </customer>
     <order>
          <product department="A02">
               <name image="/images/kuschelmaus.gif">Kuschelmaus</name>
               <id>45678924</id>
               <price>40.00</price>
               <currency>DM</currency>
               <amount>1</amount>
          </product>
          <product department="A01">
               <name image="/images/teddy.gif">Teddy</name>
               <id>12345678</id>
               <comment>waschbar</comment>
               <variation>
                    <color name="gelb"/>
                    <color name="blau"/>
                    <color name="rot" selected="true"/>
               </variation>
               <price>60.00</price>
               <currency>DM</currency>
               <amount>1</amount>
          </product>
          <product department="A02" xml:lang="de">
               <name image="/images/stoffhase.gif">Stoffhase</name>
               <id>56412579</id>
               <price>80.00</price>
               <currency>DM</currency>
               <amount>1</amount>
          </product>
          <product department="A05" xml:lang="en">
               <name image="/images/jumping_rabbit.gif">Jumping Rabbit</name>
               <id>45621578</id>
               <variation>
                    <color name="blue" selected="true"/>
                    <color name="yellow"/>
                    <color name="red"/>
               </variation>
               <price>30.00</price>
               <currency>Dollar</currency>
               <amount>2</amount>
          </product>
     </order>
</shop>


DTD

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT shop (customer, order)>

<!--
Kundeninformationen -->
<!ELEMENT customer (name, surname, address+, e-mail*, date)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT e-mail (#PCDATA)>
<!ELEMENT date (#PCDATA)>

<!--
Bestellung -->
<!ELEMENT order (product+)>
<!ELEMENT product (name, id, comment?, variation?, price+, currency+, amount)>
<!ATTLIST product department CDATA #REQUIRED xml:lang (de | en) #IMPLIED>
<!ATTLIST name image CDATA #IMPLIED>
<!ELEMENT id (#PCDATA)>
<!ELEMENT comment (#PCDATA)>
<!ELEMENT variation (color+ | size+)>
<!ELEMENT color (#PCDATA)>
<!ATTLIST color name CDATA #REQUIRED selected (true | false) #IMPLIED>
<!ELEMENT size (#PCDATA)>
<!ATTLIST size name CDATA #REQUIRED selected (true | false) #IMPLIED>
<!ELEMENT price (#PCDATA)>
<!ELEMENT currency (#PCDATA)>
<!ELEMENT amount (#PCDATA)>