XML Data (schema)



XML-Data

W3C Note January 5, 1998

- XML-Data was the first in a series of papers to describe a method for creating XML data schema.

- An XML data schema allows you to define constraints on the structure of an XML document.

Presentation Outline

• Why do we need XML Data Schema? (Isn’t a DTD good enough?)

• How XML Data Schemas are Used

• Features of XML Data Schema

• Summary

Why do we need XML Data Schema?

Schema Definition in SQL:

create table account

(account-number char(10) not null,

branch-name char(15),

balance integer,

primary key (account-number),

foreign key (branch-name) references branch,

check (balance >=0))

A DTD that is not quite equivalent to the above schema

]>

Why do we need XML Data Schema?

“Equivalent” XML Data Schema

Features of XML Data Schema

Many primitive datatypes are available and new datatypes can be defined

John Doe

123 Maple Street

Ann Arbor

MI

48109

Features of XML Data Schema

Attribute group definitions provide a construct to replace some uses of parameter entities.

...

Features of XML Data Schema

New element types can be defined by adding additional content to the content model of another type definition

John

Doe

Doe

Jr

Features of XML Data Schema

New element types can be defined by adding restrictions or eliminating content from another type definition

John

Doe

Features of XML Data Schema

Using “unique” and “key” constraints, the capabilities of XML’s ID/IDREF mechanism have been extended

Element content and combinations of attribute values and content can be declared to be unique

Combinations of attribute values and/or element content can be declared to be keys (not only unique, but always present)

Constraints can have document-wide scope or hold within the scope of particular elements

Features of XML Data Schema

. . .

. . .

.//vehicle[@regNo]

@regNo

ancestor::state/stateCode

How XML Data Schema are Used

Sample XML Data Schema

How XML Data Schema are Used

Sample XML Document that Conforms to the Schema

John Doe

50

Jane Doe

50

How XML Data Schema are Used

An XML data schema is expressed in XML instance syntax

An XML data schema must be valid with respect to a schema DTD

An XML document can identify a schema to which it is supposed to conform

An XML document is schema-valid with respect to a schema if it meets the structural and datatyping constraints expressed in the schema

The XML document processor must be schema-aware to determine if a document is schema-valid

Summary

XML Data Schemas provide a powerful mechanism for defining datatypes and constraints on document structure

XML Data Schemas are expressed in XML instance syntax

The XML document processor must be schema-aware to determine if a document is valid with respect to a schema

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download