Presentation is loading. Please wait.

Presentation is loading. Please wait.

Session IV Chapter 9 – XML Schemas

Similar presentations


Presentation on theme: "Session IV Chapter 9 – XML Schemas"— Presentation transcript:

1 Session IV Chapter 9 – XML Schemas http://www.profburnett.com

2 Outline XML Schema Basics XML Schema Data Types XML Schema Syntax XML Schema Extensibility Creating an XML Schema Associate an XML Schema to an XML Document Annotating an XML Schema 8/1/2014Copyright © Carl M. Burnett2

3 XML Schema Basics XML Schema defines: Elements Attributes Child Elements Order of Child Elements Number of Child Elements Whether an Element is Empty or can Include Text Data Types for Elements and Attributes Default and Fixed Values for Elements and Attributes 8/1/2014Copyright © Carl M. Burnett3

4 Supports Data Types Describe allowable document content Validate the correctness of data Work with data from a database Define data facets (restrictions on data) Define data patterns (data formats) Convert data between different data types 8/1/2014Copyright © Carl M. Burnett4

5 Uses XML Syntax Don't have to learn a new language Use your XML editor to edit your Schema files Use your XML parser to parse your Schema files Manipulate your Schema with the XML DOM Transform your Schema with XSLT 8/1/2014Copyright © Carl M. Burnett5

6 Syntax Rules Must begin with the XML declaration Must have one unique root element Start-tags must have matching end-tags Elements are case sensitive Elements must be closed Elements must be properly nested Attribute values must be quoted Entities must be used for special characters 8/1/2014Copyright © Carl M. Burnett6

7 XML Schemas are Extensible Reuse your Schema in other Schemas Create your own data types derived from the standard types Reference multiple schemas in the same document 8/1/2014Copyright © Carl M. Burnett7

8 Creating an XML Schema 8/1/2014Copyright © Carl M. Burnett8 1.At top of document type 2.Type <xs:schema to define root element. 3.Type Xmlns:xs=“http://www.w3c.org/2001/ XMLSchema” to declare the XML schema namespace. 4.Type > to complete the root element tag. 5.Type to complete the root element....

9 Associate an XML Schema to an XML Document 8/1/2014Copyright © Carl M. Burnett9 1.Inside the root element your XML document type: xmlns:xsi=“http://www.w3c.org/2001/ XMLSchema” 2.Type xsi:noNamespaceSchemaLocation= 3.Type ”xsd:uri” where xsd.uri is the location of the XML Schema file.

10 Annotating an XML Schema You can include standard XML comments in a XML schema document. XML Schema comments are annotations. Annotations can be parsed. 8/1/2014Copyright © Carl M. Burnett10 <xs:schema xmlns= "http://www.w3.org/2001/XMLSchema"> This XML Schema will be used to validate the set of XML documents for the Wonders of the World project....

11 Review XML Schema Basics XML Schema Data Types XML Schema Syntax XML Schema Extensibility Creating an XML Schema Associate an XML Schema to an XML Document Annotating an XML Schema 8/1/2014Copyright © Carl M. Burnett11 Next: Chapter 10 – Defining Simple XML Element Types


Download ppt "Session IV Chapter 9 – XML Schemas"

Similar presentations


Ads by Google