Integrative Programming 5
Integrative Programming 5
Syntax
Example
The basic idea behind XML Schemas is that they describe the legitimate format that an XML document
can take.
Elements
As we saw in the XML - Elements chapter, elements are the building blocks of XML document. An
element can be defined within an XSD as follows −
<xs:element name = "x" type = "y"/>
Definition Types
Simple Type
Simple type element is used only in the context of the text. Some of the predefined simple types are:
xs:integer, xs:boolean, xs:string, xs:date. For example −
______________________________________________________________________________
An institution of the United Church of Christ in the Philippines (UCCP)
Member: Association of Christian Schools, Colleges and Universities (ACSCU)
UCCP Church Related Educational Action Towards Empowerment (UCCP CREATE)
Cordillera Schools Group (CSG)
SAINT TONIS COLLEGE, INC.
(Formerly: Kalinga Christian Learning Center)
United Church of Christ in the Philippines
Purok 4, Bulanao Centro, Tabuk City, Kalinga
Philippines 3800
Tel. No. (074) 627-5930, Email Address: [email protected]
Complex Type
A complex type is a container for other element definitions. This allows you to specify which child
elements an element can contain and to provide some structure within your XML documents. For
example −
Global Types
With the global type, you can define a single type in your document, which can be used by all other
references. For example, suppose you want to generalize the person and company for different addresses
of the company. In such case, you can define a general type as follows −
<xs:element name = "AddressType">
<xs:complexType>
<xs:sequence>
<xs:element name = "name" type = "xs:string" />
<xs:element name = "company" type = "xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
Attributes
Attributes in XSD provide extra information within an element. Attributes have name and type property
as shown below −
______________________________________________________________________________
An institution of the United Church of Christ in the Philippines (UCCP)
Member: Association of Christian Schools, Colleges and Universities (ACSCU)
UCCP Church Related Educational Action Towards Empowerment (UCCP CREATE)
Cordillera Schools Group (CSG)
SAINT TONIS COLLEGE, INC.
(Formerly: Kalinga Christian Learning Center)
United Church of Christ in the Philippines
Purok 4, Bulanao Centro, Tabuk City, Kalinga
Philippines 3800
Tel. No. (074) 627-5930, Email Address: [email protected]
<xs:attribute name = "x" type = "y"/>
______________________________________________________________________________
An institution of the United Church of Christ in the Philippines (UCCP)
Member: Association of Christian Schools, Colleges and Universities (ACSCU)
UCCP Church Related Educational Action Towards Empowerment (UCCP CREATE)
Cordillera Schools Group (CSG)