Notes 22 - xml-schemasSHORTFORM

Notes 22 - xml-schemasSHORTFORM - Copyright Ellis Horowitz...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Copyright Ellis Horowitz 1998-2007 XML Schemas 1 XML Schemas Copyright Ellis Horowitz 1998-2007 XML Schemas 2 The W3C Guides XML Schemas Copyright Ellis Horowitz 1998-2007 XML Schemas 3 XML Schemas are Used to Define the Structure of XML Files Copyright Ellis Horowitz 1998-2007 XML Schemas 4 Purpose of XML Schemas (and DTDs) Specify: the structure of instance documents "this element contains these elements, which contains these other elements, etc" the datatype of each element/attribute "this element shall hold an integer within the range 0 to 12,000" (DTDs don't do too well) Copyright Ellis Horowitz 1998-2007 XML Schemas 5 Motivation for XML Schemas People are dissatisfied with DTDs It's a different syntax You write your XML (instance) document using one syntax and the DTD using another syntax --> bad, inconsistent Limited datatype capability DTDs support a very limited capability for specifying datatypes. You can't, for example, express "I want the <elevation> element to hold an integer with a range of 0 to 12,000" Desire a set of datatypes compatible with those found in databases DTD supports 10 datatypes; XML Schemas supports 44+ datatypes Copyright Ellis Horowitz 1998-2007 XML Schemas 6 Highlights of XML Schemas XML Schemas are a tremendous advancement over DTDs: Enhanced datatypes 44+ versus 10 Can create your own datatypes Example: "This is a new type based on the string type and elements of this type must follow this pattern: ddd- dddd, where 'd' represents a digit". Written in the same syntax as instance documents less syntax to remember Object-oriented'ish Can extend or restrict a type (derive new type definitions on the basis of old ones) Can express sets, i.e., can define the child elements to occur in any order Copyright Ellis Horowitz 1998-2007 XML Schemas 7 Highlights of XML Schemas (contd) Can specify element content as being unique (keys on content) and uniqueness within a region Can define multiple elements with the same name but different content Can define elements with nil content Can define substitutable elements - e.g., the "Book" element is substitutable for the "Publication" element. Copyright Ellis Horowitz 1998-2007 XML Schemas 8 Let's Get Started! Convert the BookStore.dtd (next page) to the XML Schema syntax for this first example we will make a straight, one-to-one conversion, i.e., Title, Author, Date, ISBN, and Publisher will hold strings, just like is done in the DTD We will gradually modify the XML Schema to use stronger types Copyright Ellis Horowitz 1998-2007 XML Schemas 9 BookStore.dtd <!ELEMENT BookStore (Book)+> <!ELEMENT Book (Title, Author, Date, ISBN, Publisher)> <!ELEMENT Title (#PCDATA)> <!ELEMENT Author (#PCDATA)> <!ELEMENT Date (#PCDATA)> <!ELEMENT ISBN (#PCDATA)> <!ELEMENT Publisher (#PCDATA)> Copyright Ellis Horowitz 1998-2007 XML Schemas 10 ATTLIST ELEMENT...
View Full Document

This note was uploaded on 05/12/2011 for the course CSCI 571 taught by Professor Papa during the Fall '07 term at USC.

Page1 / 85

Notes 22 - xml-schemasSHORTFORM - Copyright Ellis Horowitz...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online