Difference between revisions of "Introduction to Databases with Stanford University : DTD Exercises"
Jump to navigation
Jump to search
m (moved Intro to Databases with Stanford University : DTD Exercises to Introduction to Databases with Stanford University : DTD Exercises) |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | * Introduction to Databases by Standford University http://db-class.org | |
+ | * Additional materials: http://openclassroom.stanford.edu/MainFolder/CoursePage.php?course=IntroToDatabases | ||
+ | * Use xmllint ([[XML_Validation]]) to validate the result. | ||
− | + | 1. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/courses-noID.xml (Alternate link:[[Courses-noID.xml]]) | |
− | |||
− | 1. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/courses-noID.xml | ||
<pre> | <pre> | ||
Line 26: | Line 26: | ||
</pre> | </pre> | ||
− | 2. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/courses-ID.xml | + | 2. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/courses-ID.xml (Alternate link: [[Courses-ID.xml]]) |
<pre> | <pre> | ||
Line 52: | Line 52: | ||
</pre> | </pre> | ||
− | 3. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/countries.xml | + | 3. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/countries.xml (Alternate link: [[Countries.xml]]) |
<pre> | <pre> |
Latest revision as of 18:28, 16 November 2011
- Introduction to Databases by Standford University http://db-class.org
- Additional materials: http://openclassroom.stanford.edu/MainFolder/CoursePage.php?course=IntroToDatabases
- Use xmllint (XML_Validation) to validate the result.
1. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/courses-noID.xml (Alternate link:Courses-noID.xml)
<!ELEMENT Course_Catalog (Department*)> <!ELEMENT Department (Title, Chair, Course+)> <!ATTLIST Department Code CDATA #REQUIRED> <!ELEMENT Chair (Professor)> <!ELEMENT Course (Title, Description*, Instructors, Prerequisites*)> <!ATTLIST Course Number CDATA #REQUIRED Enrollment CDATA #IMPLIED> <!ELEMENT Instructors (Lecturer|Professor)+> <!ELEMENT Prerequisites (Prereq*)> <!ELEMENT Lecturer (First_Name,Middle_Initial*,Last_Name)+> <!ELEMENT Professor (First_Name,Middle_Initial*,Last_Name)+> <!ELEMENT Title (#PCDATA)> <!ELEMENT Description (#PCDATA)> <!ELEMENT First_Name (#PCDATA)> <!ELEMENT Last_Name (#PCDATA)> <!ELEMENT Middle_Initial (#PCDATA)> <!ELEMENT Prereq (#PCDATA)>
2. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/courses-ID.xml (Alternate link: Courses-ID.xml)
<!ELEMENT Course_Catalog (Department*)> <!ELEMENT Department (Title, Course+,(Professor|Lecturer)*)> <!ATTLIST Department Code CDATA #REQUIRED Chair IDREF #IMPLIED> <!ELEMENT Course (Title, Description*)> <!ATTLIST Course Number ID #REQUIRED Prerequisites CDATA #IMPLIED Instructors IDREFS #REQUIRED Enrollment CDATA #IMPLIED> <!ELEMENT Courseref EMPTY> <!ATTLIST Courseref Number IDREF #REQUIRED> <!ELEMENT Lecturer (First_Name,Middle_Initial*,Last_Name)> <!ELEMENT Professor (First_Name,Middle_Initial*,Last_Name)> <!ATTLIST Lecturer InstrID ID #REQUIRED> <!ATTLIST Professor InstrID ID #REQUIRED> <!ELEMENT Title (#PCDATA)> <!ELEMENT Description (#PCDATA|Courseref)*> <!ELEMENT First_Name (#PCDATA)> <!ELEMENT Last_Name (#PCDATA)> <!ELEMENT Middle_Initial (#PCDATA)>
3. Create a DTD for XML data at http://s3.amazonaws.com/dbclass-resources/docs/countries.xml (Alternate link: Countries.xml)
<!ELEMENT countries (country*)> <!ATTLIST country name CDATA #REQUIRED population CDATA #REQUIRED area CDATA #REQUIRED> <!ELEMENT country ((language|city)*)> <!ELEMENT city (name,population)> <!ELEMENT language (#PCDATA)> <!ATTLIST language percentage CDATA #REQUIRED> <!ELEMENT name (#PCDATA)> <!ELEMENT population (#PCDATA)>