XML Examples 1
XML Examples 1
Note: Many of the samples below rely on client-side XML handling and were written to utilize functionality implemented in Internet Explorer 5 and above. To browse these examples as they were designed to be seen, you should ideally be using Microsoft Internet Explorer 5 or later.
This rich notes file covers following tasks with XML: Viewing XML Files
These examples are taken from the chapter Viewing XML Files in the XML Section of this Web. A Note by Jan Egil Refsnes An XML CD catalog by Jan Egil Refsnes An XML plant catalog by Jan Egil Refsnes A Simple Menu by Jan Egil Refsnes
Navigate the recordset by Jan Egil Refsnes An application prototype by Jan Egil Refsnes
http://www.xmlfiles.com/examples/
<PRICE>10.20</PRICE> <YEAR>1990</YEAR> </CD> <CD> <TITLE>Eros</TITLE> <ARTIST>Eros Ramazzotti</ARTIST> <COUNTRY>EU</COUNTRY> <COMPANY>BMG</COMPANY> <PRICE>9.90</PRICE> <YEAR>1997</YEAR> </CD> <CD> <TITLE>One night only</TITLE> <ARTIST>Bee Gees</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>Polydor</COMPANY> <PRICE>10.90</PRICE> <YEAR>1998</YEAR> </CD> <CD> <TITLE>Sylvias Mother</TITLE> <ARTIST>Dr.Hook</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS</COMPANY> <PRICE>8.10</PRICE> <YEAR>1973</YEAR> </CD> <CD> <TITLE>Maggie May</TITLE> <ARTIST>Rod Stewart</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>Pickwick</COMPANY> <PRICE>8.50</PRICE> <YEAR>1990</YEAR> </CD> <CD> <TITLE>Romanza</TITLE> <ARTIST>Andrea Bocelli</ARTIST> <COUNTRY>EU</COUNTRY> <COMPANY>Polydor</COMPANY> <PRICE>10.80</PRICE> <YEAR>1996</YEAR> </CD> <CD> <TITLE>When a man loves a woman</TITLE> <ARTIST>Percy Sledge</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Atlantic</COMPANY> <PRICE>8.70</PRICE> <YEAR>1987</YEAR> </CD> <CD> <TITLE>Black angel</TITLE> <ARTIST>Savage Rose</ARTIST> <COUNTRY>EU</COUNTRY> <COMPANY>Mega</COMPANY> <PRICE>10.90</PRICE>
<YEAR>1995</YEAR> </CD> <CD> <TITLE>1999 Grammy Nominees</TITLE> <ARTIST>Many</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Grammy</COMPANY> <PRICE>10.20</PRICE> <YEAR>1999</YEAR> </CD> <CD> <TITLE>For the good times</TITLE> <ARTIST>Kenny Rogers</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>Mucik Master</COMPANY> <PRICE>8.70</PRICE> <YEAR>1995</YEAR> </CD> <CD> <TITLE>Big Willie style</TITLE> <ARTIST>Will Smith</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>9.90</PRICE> <YEAR>1997</YEAR> </CD> <CD> <TITLE>Tupelo Honey</TITLE> <ARTIST>Van Morrison</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>Polydor</COMPANY> <PRICE>8.20</PRICE> <YEAR>1971</YEAR> </CD> <CD> <TITLE>Soulsville</TITLE> <ARTIST>Jorn Hoel</ARTIST> <COUNTRY>Norway</COUNTRY> <COMPANY>WEA</COMPANY> <PRICE>7.90</PRICE> <YEAR>1996</YEAR> </CD> <CD> <TITLE>The very best of</TITLE> <ARTIST>Cat Stevens</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>Island</COMPANY> <PRICE>8.90</PRICE> <YEAR>1990</YEAR> </CD> <CD> <TITLE>Stop</TITLE> <ARTIST>Sam Brown</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>A and M</COMPANY> <PRICE>8.90</PRICE> <YEAR>1988</YEAR>
</CD> <CD> <TITLE>Bridge of Spies</TITLE> <ARTIST>T`Pau</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>Siren</COMPANY> <PRICE>7.90</PRICE> <YEAR>1987</YEAR> </CD> <CD> <TITLE>Private Dancer</TITLE> <ARTIST>Tina Turner</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>Capitol</COMPANY> <PRICE>8.90</PRICE> <YEAR>1983</YEAR> </CD> <CD> <TITLE>Midt om natten</TITLE> <ARTIST>Kim Larsen</ARTIST> <COUNTRY>EU</COUNTRY> <COMPANY>Medley</COMPANY> <PRICE>7.80</PRICE> <YEAR>1983</YEAR> </CD> <CD> <TITLE>Pavarotti Gala Concert</TITLE> <ARTIST>Luciano Pavarotti</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>DECCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1991</YEAR> </CD> <CD> <TITLE>The dock of the bay</TITLE> <ARTIST>Otis Redding</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Atlantic</COMPANY> <PRICE>7.90</PRICE> <YEAR>1987</YEAR> </CD> <CD> <TITLE>Picture book</TITLE> <ARTIST>Simply Red</ARTIST> <COUNTRY>EU</COUNTRY> <COMPANY>Elektra</COMPANY> <PRICE>7.20</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Red</TITLE> <ARTIST>The Communards</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>London</COMPANY> <PRICE>7.80</PRICE> <YEAR>1987</YEAR> </CD>
<CD> <TITLE>Unchain my heart</TITLE> <ARTIST>Joe Cocker</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>EMI</COMPANY> <PRICE>8.20</PRICE> <YEAR>1987</YEAR> </CD> </CATALOG>
<AVAILABILITY>012099</AVAILABILITY> </PLANT> <PLANT> <COMMON>Ginger, Wild</COMMON> <BOTANICAL>Asarum canadense</BOTANICAL> <ZONE>3</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$9.03</PRICE> <AVAILABILITY>041899</AVAILABILITY> </PLANT> <PLANT> <COMMON>Hepatica</COMMON> <BOTANICAL>Hepatica americana</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$4.45</PRICE> <AVAILABILITY>012699</AVAILABILITY> </PLANT> <PLANT> <COMMON>Liverleaf</COMMON> <BOTANICAL>Hepatica americana</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$3.99</PRICE> <AVAILABILITY>010299</AVAILABILITY> </PLANT> <PLANT> <COMMON>Jack-In-The-Pulpit</COMMON> <BOTANICAL>Arisaema triphyllum</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$3.23</PRICE> <AVAILABILITY>020199</AVAILABILITY> </PLANT> <PLANT> <COMMON>Mayapple</COMMON> <BOTANICAL>Podophyllum peltatum</BOTANICAL> <ZONE>3</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$2.98</PRICE> <AVAILABILITY>060599</AVAILABILITY> </PLANT> <PLANT> <COMMON>Phlox, Woodland</COMMON> <BOTANICAL>Phlox divaricata</BOTANICAL> <ZONE>3</ZONE> <LIGHT>Sun or Shade</LIGHT> <PRICE>$2.80</PRICE> <AVAILABILITY>012299</AVAILABILITY> </PLANT> <PLANT> <COMMON>Phlox, Blue</COMMON> <BOTANICAL>Phlox divaricata</BOTANICAL> <ZONE>3</ZONE> <LIGHT>Sun or Shade</LIGHT> <PRICE>$5.59</PRICE> <AVAILABILITY>021699</AVAILABILITY>
</PLANT> <PLANT> <COMMON>Spring-Beauty</COMMON> <BOTANICAL>Claytonia Virginica</BOTANICAL> <ZONE>7</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$6.59</PRICE> <AVAILABILITY>020199</AVAILABILITY> </PLANT> <PLANT> <COMMON>Trillium</COMMON> <BOTANICAL>Trillium grandiflorum</BOTANICAL> <ZONE>5</ZONE> <LIGHT>Sun or Shade</LIGHT> <PRICE>$3.90</PRICE> <AVAILABILITY>042999</AVAILABILITY> </PLANT> <PLANT> <COMMON>Wake Robin</COMMON> <BOTANICAL>Trillium grandiflorum</BOTANICAL> <ZONE>5</ZONE> <LIGHT>Sun or Shade</LIGHT> <PRICE>$3.20</PRICE> <AVAILABILITY>022199</AVAILABILITY> </PLANT> <PLANT> <COMMON>Violet, Dog-Tooth</COMMON> <BOTANICAL>Erythronium americanum</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$9.04</PRICE> <AVAILABILITY>020199</AVAILABILITY> </PLANT> <PLANT> <COMMON>Trout Lily</COMMON> <BOTANICAL>Erythronium americanum</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$6.94</PRICE> <AVAILABILITY>032499</AVAILABILITY> </PLANT> <PLANT> <COMMON>Adder's-Tongue</COMMON> <BOTANICAL>Erythronium americanum</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$9.58</PRICE> <AVAILABILITY>041399</AVAILABILITY> </PLANT> <PLANT> <COMMON>Anemone</COMMON> <BOTANICAL>Anemone blanda</BOTANICAL> <ZONE>6</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$8.86</PRICE> <AVAILABILITY>122698</AVAILABILITY> </PLANT>
<PLANT> <COMMON>Grecian Windflower</COMMON> <BOTANICAL>Anemone blanda</BOTANICAL> <ZONE>6</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$9.16</PRICE> <AVAILABILITY>071099</AVAILABILITY> </PLANT> <PLANT> <COMMON>Bee Balm</COMMON> <BOTANICAL>Monarda didyma</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$4.59</PRICE> <AVAILABILITY>050399</AVAILABILITY> </PLANT> <PLANT> <COMMON>Bergamont</COMMON> <BOTANICAL>Monarda didyma</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$7.16</PRICE> <AVAILABILITY>042799</AVAILABILITY> </PLANT> <PLANT> <COMMON>Black-Eyed Susan</COMMON> <BOTANICAL>Rudbeckia hirta</BOTANICAL> <ZONE>Annual</ZONE> <LIGHT>Sunny</LIGHT> <PRICE>$9.80</PRICE> <AVAILABILITY>061899</AVAILABILITY> </PLANT> <PLANT> <COMMON>Buttercup</COMMON> <BOTANICAL>Ranunculus</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$2.57</PRICE> <AVAILABILITY>061099</AVAILABILITY> </PLANT> <PLANT> <COMMON>Crowfoot</COMMON> <BOTANICAL>Ranunculus</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$9.34</PRICE> <AVAILABILITY>040399</AVAILABILITY> </PLANT> <PLANT> <COMMON>Butterfly Weed</COMMON> <BOTANICAL>Asclepias tuberosa</BOTANICAL> <ZONE>Annual</ZONE> <LIGHT>Sunny</LIGHT> <PRICE>$2.78</PRICE> <AVAILABILITY>063099</AVAILABILITY> </PLANT> <PLANT>
<COMMON>Cinquefoil</COMMON> <BOTANICAL>Potentilla</BOTANICAL> <ZONE>Annual</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$7.06</PRICE> <AVAILABILITY>052599</AVAILABILITY> </PLANT> <PLANT> <COMMON>Primrose</COMMON> <BOTANICAL>Oenothera</BOTANICAL> <ZONE>3 - 5</ZONE> <LIGHT>Sunny</LIGHT> <PRICE>$6.56</PRICE> <AVAILABILITY>013099</AVAILABILITY> </PLANT> <PLANT> <COMMON>Gentian</COMMON> <BOTANICAL>Gentiana</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Sun or Shade</LIGHT> <PRICE>$7.81</PRICE> <AVAILABILITY>051899</AVAILABILITY> </PLANT> <PLANT> <COMMON>Blue Gentian</COMMON> <BOTANICAL>Gentiana</BOTANICAL> <ZONE>4</ZONE> <LIGHT>Sun or Shade</LIGHT> <PRICE>$8.56</PRICE> <AVAILABILITY>050299</AVAILABILITY> </PLANT> <PLANT> <COMMON>Jacob's Ladder</COMMON> <BOTANICAL>Polemonium caeruleum</BOTANICAL> <ZONE>Annual</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$9.26</PRICE> <AVAILABILITY>022199</AVAILABILITY> </PLANT> <PLANT> <COMMON>Greek Valerian</COMMON> <BOTANICAL>Polemonium caeruleum</BOTANICAL> <ZONE>Annual</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$4.36</PRICE> <AVAILABILITY>071499</AVAILABILITY> </PLANT> <PLANT> <COMMON>California Poppy</COMMON> <BOTANICAL>Eschscholzia californica</BOTANICAL> <ZONE>Annual</ZONE> <LIGHT>Sun</LIGHT> <PRICE>$7.89</PRICE> <AVAILABILITY>032799</AVAILABILITY> </PLANT> <PLANT> <COMMON>Shooting Star</COMMON>
<BOTANICAL>Dodecatheon</BOTANICAL> <ZONE>Annual</ZONE> <LIGHT>Mostly Shady</LIGHT> <PRICE>$8.60</PRICE> <AVAILABILITY>051399</AVAILABILITY> </PLANT> <PLANT> <COMMON>Snakeroot</COMMON> <BOTANICAL>Cimicifuga</BOTANICAL> <ZONE>Annual</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$5.63</PRICE> <AVAILABILITY>071199</AVAILABILITY> </PLANT> <PLANT> <COMMON>Cardinal Flower</COMMON> <BOTANICAL>Lobelia cardinalis</BOTANICAL> <ZONE>2</ZONE> <LIGHT>Shade</LIGHT> <PRICE>$3.02</PRICE> <AVAILABILITY>022299</AVAILABILITY> </PLANT> </CATALOG>
<name>French Toast</name> <price>$4.50</price> <description> thick slices made from our homemade sourdough bread </description> <calories>600</calories> </food> <food> <name>Homestyle Breakfast</name> <price>$6.95</price> <description> two eggs, bacon or sausage, toast, and our ever-popular hash browns </description> <calories>950</calories> </food> </breakfast-menu>
Internal DTD
This is an XML document with a Document Type Definition: (Open it in IE5, and select view source)
<?xml version="1.0"?> <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
CDATAA=Character-DATA: That does not need parsing. Just text is picked as it appears. PCDATA= Parsed Character DATA: Text is between open/close tags and parser is required to separate the text from TAGS.
#CDATA means the element contains character data that is not supposed to be parsed by a parser.
#PCDATA means that the element contains data that IS going to be parsed by a parser.
Line: <!ELEMENT note (to,from,heading,body)> defines total number of child nodes to expect under parent node: e.g 4 elements
The DTD is interpreted like this: !ELEMENT note (in line 2) defines the element "note" as having four elements: "to,from,heading,body". !ELEMENT to (in line 3) defines the "to" element to be of the type "CDATA". !ELEMENT from (in line 4) defines the "from" element to be of the type "CDATA" and so on..... NOTE :: Public class CDATA extends text. An XML CDATA section. Represents
character-based content within an XML document that should be output within special CDATA tags.
External DTD
This is the same XML document with an external DTD: (Open it in IE5, and select view source)
<?xml version="1.0"?> <!DOCTYPE note SYSTEM "note.dtd"> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
This is a copy of the file "note.dtd" containing the Document Type Definition:
<?xml version="1.0"?> <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)>
Elements
Elements are the main building blocks of both XML and HTML documents. Examples of HTML elements are "body" and "table". Examples of XML elements could be "note" and "message". Elements can contain text, other elements, or be empty. Examples of empty HTML elements are "hr", "br" and "img".
Tags
Tags are used to markup elements. A starting tag like <element_name> mark up the beginning of an element, and an ending tag like </element_name> mark up the end of an element. Examples: A body element: <body>body text in between</body>. A message element: <message>some message in between</message>
Attributes
Attributes provide extra information about elements. Attributes are placed inside the start tag of an element. Attributes come in name/value pairs. The following "img" element has an additional information about a source file:
PCDATA
PCDATA means parsed character data. Think of character data as the text found between the start tag and the end tag of an XML element. PCDATA is text that will be parsed by a parser. Tags inside the text will be treated as markup and entities will be expanded.
CDATA
CDATA also means character data. CDATA is text that will NOT be parsed by a parser. Tags inside the text will NOT be treated as markup and entities will not be expanded.
Entities
Entities as variables used to define common text. Entity references are references to entities.
Most of you will known the HTML entity reference: " " that is used to insert an extra space in an HTML document. Entities are expanded when a document is parsed by an XML parser. The following entities are predefined in XML: Entity References Character
DTD - Elements
by Jan Egil Refsnes
Declaring an Element
In the DTD, XML elements are declared with an element declaration. An element declaration has the following syntax:
Empty elements
Empty elements are declared with the keyword EMPTY inside the parentheses:
#CDATA means the element contains character data that is not supposed to be parsed by a parser. #PCDATA means that the element contains data that IS going to be parsed by a parser. The keyword ANY declares an element with any content. If a #PCDATA section contains elements, these elements must also be declared.
<!ELEMENT element-name (child-element-name)> or <!ELEMENT element-name (child-element-name,child-element-name,.....)> example: <!ELEMENT note (to,from,heading,body)>
When children are declared in a sequence separated by commas, the children must appear in the same sequence in the document. In a full declaration, the children must also be declared, and the children can also have children. The full declaration of the note document will be:
Wrapping
If the DTD is to be included in your XML source file, it should be wrapped in a DOCTYPE definition with the following syntax:
<!DOCTYPE root-element [element-declarations]> example: <?xml version="1.0"?> <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)>
]> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend</body> </note>
The + sign in the example above declares that the child element message must occur one or more times inside the note element.
The * sign in the example above declares that the child element message can occur zero or more
times inside the note element.
The ? sign in the example above declares that the child element message can occur zero or one times
inside the note element.
The example above declares that the element note must contain at least one to child element, exactly one from child element, exactly one header, zero or more message, and some other parsed character data as well. Puh!
DTD - Attributes
by Jan Egil Refsnes
Declaring Attributes
In the DTD, XML element attributes are declared with an ATTLIST declaration. An attribute declaration has the following syntax:
The value is character data The value is an unique id The value is the id of another element The value is a list of other ids The value is a valid XML name The value is a list of valid XML names The value is an entity The value is a list of entities The value is a name of a notation The value is predefined
The attribute has a default value The attribute value must be included in the element The attribute does not have to be included The attribute value is fixed
Implied attribute
Syntax: <!ATTLIST element-name attribute-name attribute-type #IMPLIED> DTD example: <!ATTLIST contact fax CDATA #IMPLIED> XML example: <contact fax="555-667788">
Use an implied attribute if you don't want to force the author to include an attribute and you don't have an option for a default value either.
Required attribute
Syntax: <!ATTLIST element-name attribute_name attribute-type #REQUIRED> DTD example: <!ATTLIST person number CDATA #REQUIRED> XML example: <person number="5677">
Use a required attribute if you don't have an option for a default value, but still want to force the attribute to be present.
DTD - Entities
by Jan Egil Refsnes
Entities
Entities as variables used to define shortcuts to common text. Entity references are references to entities. Entities can be declared internal. Entities can be declared external
DTD Example: <!ENTITY writer "Jan Egil Refsnes."> <!ENTITY copyright "Copyright XML101."> XML example: <author>&writer;©right;</author>
DTD Validation
by Jan Egil Refsnes
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM") xmlDoc.async="false" xmlDoc.validateOnParse="true" xmlDoc.load("note_dtd_error.xml") document.write("<br>Error Code: ") document.write(xmlDoc.parseError.errorCode) document.write("<br>Error Reason: ") document.write(xmlDoc.parseError.reason) document.write("<br>Error Line: ") document.write(xmlDoc.parseError.line)
Try it Yourself or or just look at the XML file
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM") xmlDoc.async="false" xmlDoc.validateOnParse="false" xmlDoc.load("note_dtd_error.xml") document.write("<br>Error Code: ") document.write(xmlDoc.parseError.errorCode) document.write("<br>Error Reason: ") document.write(xmlDoc.parseError.reason) document.write("<br>Error Line: ") document.write(xmlDoc.parseError.line)
Try it Yourself
TV Scedule DTD
By David Moisan. Copied from his Web: http://www1.shore.net/~dmoisan/
<!DOCTYPE TVSCHEDULE [ <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT TVSCHEDULE (CHANNEL+)> CHANNEL (BANNER, DAY+)> BANNER (#PCDATA)> DAY ((DATE, HOLIDAY) | (DATE, PROGRAMSLOT+))+> HOLIDAY (#PCDATA)> DATE (#PCDATA)> PROGRAMSLOT (TIME, TITLE, DESCRIPTION?)> TIME (#PCDATA)>
<!ELEMENT TITLE (#PCDATA)> <!ELEMENT DESCRIPTION (#PCDATA)> <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST ]> TVSCHEDULE NAME CDATA #REQUIRED> CHANNEL CHAN CDATA #REQUIRED> PROGRAMSLOT VTR CDATA #IMPLIED> TITLE RATING CDATA #IMPLIED> TITLE LANGUAGE CDATA #IMPLIED>
A Report DTD
By Richard Erlander. Copied from his Web: http://pdbeam.uwaterloo.ca/~rlander/
<!DOCTYPE REPORT [ <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT REPORT (TITLE,(SECTION|SHORTSECT)+)> SECTION (TITLE,%BODY;,SUBSECTION*)> SUBSECTION (TITLE,%BODY;,SUBSECTION*)> SHORTSECT (TITLE,%BODY;)> TITLE %TEXT;> PARA %TEXT;> LIST (ITEM)+> ITEM (%BLOCK;)> CODE (#PCDATA)> KEYWORD (#PCDATA)> EXAMPLE (TITLE?,%BLOCK;)> GRAPHIC EMPTY>
<!ATTLIST REPORT security (high | medium | low ) "low"> <!ATTLIST CODE type CDATA #IMPLIED> <!ATTLIST GRAPHIC file ENTITY #REQUIRED> <!ENTITY <!ENTITY <!ENTITY <!ENTITY <!ENTITY <!ENTITY xml "Extensible Markup Language"> sgml "Standard Generalized Markup Language"> pxa "Professional XML Authoring"> % TEXT "(#PCDATA|CODE|KEYWORD|QUOTATION)*"> % BLOCK "(PARA|LIST)+"> % BODY "(%BLOCK;|EXAMPLE|NOTE)+">
<!NOTATION GIF SYSTEM ""> <!NOTATION JPG SYSTEM ""> <!NOTATION BMP SYSTEM ""> ]>
<!DOCTYPE NEWSPAPER [ <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST NEWSPAPER (ARTICLE+)> ARTICLE (HEADLINE, BYLINE, LEAD, BODY, NOTES)> HEADLINE (#PCDATA)> BYLINE (#PCDATA)> LEAD (#PCDATA)> BODY (#PCDATA)> NOTES (#PCDATA)> ARTICLE ARTICLE ARTICLE ARTICLE AUTHOR CDATA #REQUIRED> EDITOR CDATA #IMPLIED> DATE CDATA #IMPLIED> EDITION CDATA #IMPLIED>
<!ENTITY NEWSPAPER "Vervet Logic Times"> <!ENTITY PUBLISHER "Vervet Logic Press"> <!ENTITY COPYRIGHT "Copyright 1998 Vervet Logic Press"> ]>
<!DOCTYPE CATALOG [ <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT <!ELEMENT CATALOG (PRODUCT+)> PRODUCT (SPECIFICATIONS+, OPTIONS?, PRICE+, NOTES?)> SPECIFICATIONS (#PCDATA)> OPTIONS (#PCDATA)> PRICE (#PCDATA)> NOTES (#PCDATA)>
<!ATTLIST PRODUCT NAME CDATA #IMPLIED> <!ATTLIST CATEGORY (HandTool | Table | Shop-Professional) "HandTool"> <!ATTLIST PARTNUM CDATA #IMPLIED> <!ATTLIST PLANT (Pittsburgh | Milwaukee | Chicago) "Chicago"> <!ATTLIST INVENTORY (InStock | Backordered | Discontinued) "InStock"> <!ATTLIST SPECIFICATIONS WEIGHT CDATA #IMPLIED> <!ATTLIST POWER CDATA #IMPLIED> <!ATTLIST OPTIONS FINISH (Metal | Polished | Matte) "Matte"> <!ATTLIST OPTIONS ADAPTER (Included | Optional | NotApplicable) "Included"> <!ATTLIST OPTIONS CASE (HardShell | Soft | NotApplicable) "HardShell"> <!ATTLIST PRICE MSRP CDATA #IMPLIED> <!ATTLIST PRICE WHOLESALE CDATA #IMPLIED> <!ATTLIST PRICE STREET CDATA #IMPLIED> <!ATTLIST PRICE SHIPPING CDATA #IMPLIED> <!ENTITY AUTHOR "John Doe"> <!ENTITY COMPANY "JD Power Tools, Inc.">