An Introduction to XML Schema CSCI 7818 by Ming Rutar.
Published byModified over 4 years ago
Presentation on theme: "An Introduction to XML Schema CSCI 7818 by Ming Rutar."— Presentation transcript:
An Introduction to XML Schema CSCI 7818 by Ming Rutar
Resources XML Schema is a W3C Recommendation http://www.w3.org/XML/Schema
Motivation Purpose of DTD : Sharing grammar/data with others Validation by the parser Defaulting of values. Shortcomings of DTD a very limited capability for specifying datatypes. incompatible set of datatypes with those found in databases inconsistent syntax with XML
XML Schema Requirements Structural Schemas Besides analogizing DTD, there are specific goals beyond DTD: Integration with namespace Definition of incomplete constraints on content of an element type Integration of structural schemas with primitive data types inheritance
XML Schema Requirements (2) Primitive Data Typing Based on experience with SQL, Java primitives. Conformance Define the relation of schemata to XML document instances, and obligations on schema-aware processors.
Example (Schema) <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.books.org" xmlns="http://www.books.org" elementFormDefault="qualified">
Example (vocabulary) DTDBookStoreSchema ELEMENT #PCDATA ATTLIST ID NMTOKEN CDATA ENTITY BookStore Book Title Author Date ISBN Publisher complexType element sequence schema string boolean integer
Data Types A complex types allow elements in their content and may carry attributes A simple types cannot have element content and cannot carry attributes, such integer. A ur-type definition is present in each ·XML Schema·, serving as the root of the type definition hierarchy for that schema. Primitive datatypes are those that are not defined in terms of other datatypes Derived datatypes are those that are defined in terms of other datatypes.
Mapping between DTD and Schema http://ucsu.colorado.edu/~rutar/map_between_dtd_and_schema.ht m
An Instance Document <BookStore xmlns =http://www.books.org-1http://www.books.org xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance-2http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation="http://www.books.org BookStore.xsd">-3 My Life and Times Paul McCartney July, 1998 94303-12021-43892 McMillin Publishing...