Download presentation
Presentation is loading. Please wait.
1
A Simple Schema Design
2
First Schema Design Being a Dog Is a Full-Time Job Charles M. Schulz Snoopy Peppermint Patty 1950-10-04 extroverted beagle Peppermint Patty 1966-08-22 bold, brash and tomboyish
3
An Example To start, we open a xs:schema element The schema element opens our schema..../...
4
An Example Define an element named book. –has attributes and non text children –consider it as a complexType –(simpleType for values only and no element or attribute sub-nodes )
5
An Example list of children of the book element is described by a sequence element: sequence is a "compositor" that defines an ordered sequence of sub-elements. There are two other compositors, choice and all.../....../...
6
An Example Define the title and author elements as simple types –don't have attributes or non-text children –can be described directly within a degenerate element element –type (xs:string) is prefixed by the namespace prefix associated with XML Schema indicating a predefined XML Schema datatype
7
An Example deal with the character element –a complex type. –its cardinality is defined:.../...
8
An Example W3C XML Schema lets us define the cardinality of an element (i.e. the number of its possible occurrences) with some precision –specify both minOccurs (the minimum number of occurences) –maxOccurs (the maximum number of occurrences) maxOccurs is set to unbounded – as many occurrences of the character element as the author wishes –Both attributes have a default value of one (1)
9
An Example specify then the list of all its children in the same way: <xs:element name="friend-of" type="xs:string" minOccurs="0" axOccurs="unbounded"/>
10
An Example declare the attributes of the document elements, which must always come last –it was more natural to define the attributes after the elements
11
Complete Schema <xs:element name="friend-of" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.