Download presentation
Presentation is loading. Please wait.
Published byJodie Fox Modified over 9 years ago
1
XML Schema
2
Why Validate XML? XML documents can generally have any structure XML grammars define specific document structures Validation is the act of checking an XML document against a DTD or XML schema defined for a grammar XML documents can generally have any structure XML grammars define specific document structures Validation is the act of checking an XML document against a DTD or XML schema defined for a grammar
3
XSD <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/example" xmlns:ex="http://tempuri.org/example"> …schema definitions go here… <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/example" xmlns:ex="http://tempuri.org/example"> …schema definitions go here…
4
What Are Built-In Datatypes? W3C XML schemas define many built-in datatypes Built-in datatypes can be primitive or derived Examples: integer,long,short… W3C XML schemas define many built-in datatypes Built-in datatypes can be primitive or derived Examples: integer,long,short…
5
Element Declarations <xs:element name="elementname" type="datatype“ (fixed="fixedvalue" | default="defaultvalue") minOccurs="value" maxOccurs="value" … /> <xs:element name="author" type="xs:string" maxOccurs="unbounded" /> <xs:element name="elementname" type="datatype“ (fixed="fixedvalue" | default="defaultvalue") minOccurs="value" maxOccurs="value" … /> <xs:element name="author" type="xs:string" maxOccurs="unbounded" />
6
Attribute Declarations <xs:attribute name="attributename" type="datatype" (fixed="fixedvalue" | default="defaultvalue") use= ("optional" | "prohibited" | "required") … /> <xs:attribute name="attributename" type="datatype" (fixed="fixedvalue" | default="defaultvalue") use= ("optional" | "prohibited" | "required") … />
7
Derive New Simple Types
10
How to Reference Simple Types
12
Better idea
13
Complex Datatypes
14
Explicit complex type for reuse
15
Element that can only contain one of a predefined set Element that can only contain one of a predefined set
16
Elements that contain optional child elements in any order Elements that contain optional child elements in any order
17
Complex Datatypes with Attributes
18
Extend the base content by adding an attribute 12.75 12.75
19
How to Reference Existing Declarations
21
How to Create Element Groups
23
How to Create Attribute Groups
24
Derive New Complex Types
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.