DOC PREVIEW
Duke CPS 116 - XML, DTD, and XML Schema

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Announcements Tue Sep 30 Homework 2 2 due Thursday Ying will run a help session this Wednesday 5 6pm XML DTD and XML Schema Graded Homework 1 available Midterm next Thursday y in class Open book open notes Sample midterm from last year available CPS 116 Introduction to Database Systems Sample solution will be available next Tuesday Project milestone 1 due in 2 weeks I will be pitching various project ideas in class From HTML to XML eXtensible Markup Language 3 HTML describes presentation of content Just like HTML you can ship XML data across platforms Relational data requires heavy weight protocols e g JDBC XML describes only the content Flexibility You can represent any information structured semi structured documents bibliography book title Foundations of Databases title author Abiteboul author author Hull author author Vianu author publisher Addison Wesley publisher year 1995 year book book book bibliography Relational data is best suited for structured data Extensibility Since data describes itself you can change the schema easily Separation of content from presentation simplifies content extraction and allows the same content to be presented easily in different looks XML terminology Relational schema is rigid and difficult to change 5 bibliography book ISBN ISBN 10 price 80 00 title Foundations of Databases title is textbook author Abiteboul author author Hull author author Vianu author publisher Addison Wesley publisher year 1995 year book bibliography names book title tags book title End tags book title An element is enclosed by a pair of start and end tags book book Tag Start Elements can be nested book title title book Empty elements is textbook is textbook Can be abbreviated is textbook can also have attributes book ISBN price 80 00 Elements 4 Portability h1 Bibliography h1 p i Foundations of Databases i Abiteboul Hull and Vianu br Addison Wesley 1995 p Other nice features of XML Well formed XML documents 6 A well formed XML document Follows XML lexical conventions Wrong section We show that x 0 section Right section We show that x lt 0 section Other special entities becomes gt and becomes amp Contains a single root element Has tags that are properly matched and elements that are properly nested Right section subsection subsection section Wrong section subsection section subsection 1 7 A tree representation 8 More XML features bibliography Comments Comments here CDATA section CDATA Tags book ID s and references book title author Foundations Abiteboul of Databases book year y author author publisher p Hull Vianu Addison Wesley title i section section section semistructured data Processing instructions for apps java applet And more 9 A valid XML document conforms to a Document Type Definition DTD DOCTYPE bibliography bibliography is the root element of the document ELEMENT bibliography book One or more bibliography consists of a sequence of one or more book elements ELEMENT book title author publisher year section Zero or one Zero or more book consists of a title zero or more authors an optional publisher and zero or more sections in sequence Constraints on structures and values of elements attributes etc E Example l DOCTYPE bibliography ELEMENT bibliography book ELEMENT book title author publisher year section ATTLIST book ISBN CDATA REQUIRED ATTLIST book price CDATA IMPLIED ELEMENT title PCDATA ELEMENT author PCDATA ELEMENT publisher PCDATA ELEMENT year PCDATA ELEMENT i PCDATA ELEMENT content PCDATA i ELEMENT section title content section DTD explained cont d 10 DTD explained A DTD is optional A DTD specifies a grammar for the document Namespaces allow external schemas and qualified names book xmlns myCitationStyle http mySchema myCitationStyle title myCitationStyle title myCitationStyle author myCitationStyle author book Valid XML documents person id o12 name Homer name person person id o34 name Marge name person person id o56 father o12 mother o34 name Bart name person mother o34 name Bart name person 1995 content Introduction In this section we introduce the notion of ATTLIST book ISBN ID REQUIRED book has a required ISBN attribute which is a unique identifier ATTLIST book price CDATA IMPLIED bibliography book ISBN ISBN 10 price 80 00 title Foundations of Databases title book has an optional IMPLIED author Abiteboul author author Hull author price attribute which contains author Vianu author publisher Addison Wesley publisher character data year 1995 year book Other attribute types include IDREF reference to an ID bibliography IDREFS space separated list of references enumerated list etc 11 ELEMENT title PCDATA ELEMENT author PCDATA ELEMENT publisher PCDATA PCDATA is text that will be parsed lt etc will be parsed as entities ELEMENT year PCDATA Use a CDATA section to include text verbatim ELEMENT i PCDATA author publisher year and i contain parsed character data PCDATA i ELEMENT content content contains mixed content text optionally interspersed with i elements ELEMENT section title content section section title Introduction title Recursive declaration content In this section we introduce the notion of i semi structured data i Each section begins with a title content followed by an optional content and section title XML title content XML stands for content then zero or more sub sections section section title DTD title section title Definition title content DTD stands for content section section title Usage title content You can use DTD to content section section section Using DTD 12 DTD can be included in the XML source file xml version 1 0 DOCTYPE bibliography bibliography bibliography DTD can be external xml version 1 0 DOCTYPE bibliography SYSTEM dtds bib dtd bibliography bibliography xml version 1 0 DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Strict EN http www w3 org TR xhtml1 DTD xhtml1 strict dtd html html 2 Annoyances element type declarations 13 Consider this element content children declaration we want to represent book titles and section titles differently You can nest element content children declarations But the above nesting g mayy be illegal g Because of SGML compatibility issues When looking at name a parser would not know which way to go without looking further ahead Requirement content declaration must be deterministic i e no look ahead required Can we rewrite it into an equivalent deterministic one Also you cannot nest mixed content declarations Illegal ELEMENT Too few attribute types string CDATA token e g ID IDREF enumeration e g red green blue ID


View Full Document

Duke CPS 116 - XML, DTD, and XML Schema

Documents in this Course
Part I

Part I

8 pages

XSLT

XSLT

4 pages

XSLT

XSLT

8 pages

Part I

Part I

8 pages

XSLT

XSLT

8 pages

Load more
Download XML, DTD, and XML Schema
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view XML, DTD, and XML Schema and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view XML, DTD, and XML Schema 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?