Dixie Blake Foster

Library DTD Documents

Documents Required for XML Page using DTD

The following documents are used to define and format the DTD Library Page. In this implementation, there are three separate files: the .dtd which defines the structure of the data; the .xml, which includes the data; and the .css, which is a primitive first attempt at formatting XML with a cascading style sheet. Thus far the formatting is inconsistent between Firefox and IE. The page as rendered in IE is closest to the format I would like to achieve.

DTD

The code below is a rendering of the .dtd file that defines the structure of the data displayed in the DTD Library Page. Unfortunately, I lost the indention when I converted the text document, so the version below is a bit difficult to unravel.

The element libRecord has two children, libData and libHours. The element libData contains three children: libName, libAddress, and libContact. Element libAddress has child elements of its own, as does libContact. Element libHours has a libDayName element followed byh a choice between libOpen and libClose or LibMessage.

The structure as is has some flaws (example: I can have multiple branches, but the hours are children of the library data, which is certainly incorrect). It will be refined as the term progresses.

A more human-readable PDF version of the .dtd is also available.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE libRecord [
<!ELEMENT libRecord (libData, libHours+)>
<!ELEMENT libData (libName?, libAddress*, libContact*)>
<!ELEMENT libName (#PCDATA)>
<!ELEMENT libAddress (libBranchName,libAddr1?, libAddr2*, libCity?, libState?, libPostalCode?) >
<!ELEMENT libBranchName (#PCDATA)>
<!ELEMENT libAddr1 (#PCDATA)>
<!ELEMENT libAddr2 (#PCDATA)>
<!ELEMENT libCity (#PCDATA)>
<!ELEMENT libState (#PCDATA)>
<!ELEMENT libPostalCode (#PCDATA)>
<!ELEMENT libContact (libPosition?, libPhone*, libFax*, libEmail*, libTTY*, libAlt*)>
<!ELEMENT libPosition (#PCDATA)>
<!ELEMENT libPhone (#PCDATA)>
<!ELEMENT libFax (#PCDATA)>
<!ELEMENT libEmail (#PCDATA)>
<!ELEMENT libTTY (#PCDATA)>
<!ELEMENT libAlt (#PCDATA)>
<!ELEMENT libHours (libDayName, ((libOpen?, libClose?) | libMessage))>
<!ELEMENT libDayName (#PCDATA)>
<!ELEMENT libOpen (#PCDATA)>
<!ELEMENT libClose (#PCDATA)>
<!ELEMENT libMessage (#PCDATA)>
]>

XML

The .xml file contains the data in the structure defined in the .dtd. The data must conform to the rules of order, hierarchy, and cardinality established in the .dtd. The data below contains one library, two branches, two contacts, and eight sets of hours. The DTD Library Page can be viewed as formatted by the very simple .css file below.

A more human-readable PDF version of the .xml is also available.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/css" href="library.css"?>
<libRecord>
<libData>
<libName>My New Library</libName>
<libAddress>
<libBranchName>Beatley</libBranchName>
<libAddr1>300 The Fenway</libAddr1>
<libCity>Boston</libCity>
<libState>MA</libState>
<libPostalCode>02115</libPostalCode>
</libAddress>
<libAddress>
<libBranchName>Career Resource Library</libBranchName>
<libAddr1>2 Palace Rd</libAddr1>
<libCity>Boston</libCity>
<libState>MA</libState>
<libPostalCode>02115</libPostalCode>
</libAddress>
<libContact>
<libPosition>Director</libPosition>
<libPhone>617-555-1212</libPhone>
</libContact>
<libContact>
<libPosition>Reference Desk</libPosition>
<libPhone>617-521-1313</libPhone>
</libContact>
</libData>
<libHours>
<libDayName>Monday</libDayName>
<libOpen>9 AM</libOpen>
<libClose>10 PM</libClose>
</libHours>
<libHours>
<libDayName>Tuesday</libDayName>
<libOpen>9 AM</libOpen>
<libClose>10 PM</libClose>
</libHours>
<libHours>
<libDayName>Wednesday</libDayName>
<libOpen>9 AM</libOpen>
<libClose>10 PM</libClose>
</libHours>
<libHours>
<libDayName>Thursday</libDayName>
<libOpen>9 AM</libOpen>
<libClose>10 PM</libClose>
</libHours>
<libHours>
<libDayName>Friday</libDayName>
<libOpen>9 AM</libOpen>
<libClose>8 PM</libClose>
</libHours>
<libHours>
<libDayName>Saturday</libDayName>
<libOpen>10 AM</libOpen>
<libClose>8 PM</libClose>
</libHours>
<libHours>
<libDayName>Sunday</libDayName>
<libOpen>Noon</libOpen>
<libClose>6 PM</libClose>
</libHours>
<libHours>
<libDayName>Presidents Day</libDayName>
<libMessage>Closed all day February 20</libMessage>
</libHours>
</libRecord><

CSS

The style sheet represented below is a first cut at formatting the XML data. It looks reasonable in Internet Explorer, but Firefox seems to ignore colors and fonts, and I have not been able to insert literal strings yet.

A more human-readable style sheet in .pdf format is also available.

<?xml version-"1.0" encoding="UTF-8"?>
libRecord
{background-color: "#CCCCCC";
color: "#333333";
font-family: tahoma, arial, sans-serif;
}
libName
{display: block;
text-align: center;
font-weight: bold;
font-size: 36pt;
}
libAddress
{display: block;
text-align: left;
font-weight: regular;
}
libBranchName
{display: block;
font-size: 24pt;
}
libContact:before
{display: block;
font-size: 14pt;
content: "Contact Information";
}
libContact
{display: block;
font-size: 14pt;
content: "Contact Information";
}
libHours
{display: block;
text-align: left;
font-weight: regular;
}
libMessage
{display: block;
text-align: left;
font-weight: bold;
}
libOpen
{display: in-line;
text-align: left;
font-weight: regular;
}
libOpen: after
(content: to;
}
libClose
{display: in-line;
text-align: left;
font-weight: regular;
}

Simmons Privacy Policy | Contact Me | ©2006 Dixie Blake Foster | 13-Mar-2006 | Valid HTML 4.01 Transitional