Note 6 for XML

Watch & Read:

What is a namespace: A namespace is a set of definitions or rules for naming elements that is located on the Internet.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
is the default namespace for schemas.

If I wanted to create a namespace called Jon for my XML documents. I would have to identify a location (URL or URI) on the Web that has the naming convention I created documented.

<Jon:root-element xmlnsp:Jon="http://www.pvc.maricopa.edu/~storslee/cis234/schema">

Schemas is a more powerful version of DTD!

The book breaks down Schema into DataType & Structures.

A DataType specifies the type of information to be found and add constraints as to what is acceptable.

Schema Structures areSimple or Complex

 

Syntax for Schemas: Sample XSD

<?xml version="1.0" ?> To identify it as an XML document

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

Schema definitions

</xs:schema>

(Save the file with the extension of xsd, example: jon.xsd)

Common XML Schema Data Types

xs:string
xs:integer
xs:date
xs:decimal
xs:boolean
xs:time

The Syntax for attching a Schema (for a XML document without a defined namespace) to an XML document is:

<?xml version="1.0"?>

<RootElement   xsi:noNamespaceSchemaLocation="cis234.xsd"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

XML Elements & Attributes

</RootElement>

 

Review the following:

W3schools Schema

Schema for class

Online Validation using Schema's can be found at http://www.w3.org/2001/03/webdata/xsv

Terms you need to Lookup:

Schema, DataTypes, Simple Elements, Complex Elements,

DataTypes: integer, string, decimal, date, time

Homework:

You should be reading Chap 9 & 10

Create a Schema for each of your XML documents

 

Final Step:

Review in your mind everything we covered in class and remember to cover it again before you go to bed so your mind to process this information while you sleep.