Tutorial.04

Tutorial.04 - TUTORIAL 4 XP WORKING WITH SCHEMAS New...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 4 1 XP TUTORIAL 4 WORKING WITH SCHEMAS
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 4 2 XP SCHEMAS A schema is an XML document that defines the content and structure of one or more XML documents. The XML document containing the content is called the instance document .
Background image of page 2
New Perspectives on XML, 2nd Edition Tutorial 4 3 XP COMPARING SCHEMAS AND DTDS This figure compares schemas and DTDs
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 4 4 XP SCHEMA VOCABULARIES There is no single schema form. Several schema “vocabularies” have been developed in the XML language. Support for a particular schema depends on the XML parser being used for validation.
Background image of page 4
New Perspectives on XML, 2nd Edition Tutorial 4 5 XP SCHEMA VOCABULARIES This figure shows a few schema vocabularies
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 4 6 XP STARTING A SCHEMA FILE A schema is always placed in a separate XML document that is referenced by the instance document.
Background image of page 6
New Perspectives on XML, 2nd Edition Tutorial 4 7 XP ELEMENTS AND ATTRIBUTES OF THE PATIENTS DOCUMENT This figure shows the elements and attributes of the patients.xml document
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 4 8 XP SCHEMA TYPES XML Schema recognize two categories of element types: complex and simple. A complex type element has one or more attributes, or is the parent to one or more child elements. A simple type element contains only character data and has no attributes.
Background image of page 8
New Perspectives on XML, 2nd Edition Tutorial 4 9 XP SCHEMA TYPES This figure shows types of elements
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 4 10 XP SIMPLE TYPE ELEMENTS Use the following syntax to declare a simple type element in XML Schema: <element name=“ name ” type =“ type ”/> Here, name is the name of the element in the instance document and type is the data type of the element. If a namespace prefix is used with the XML Schema namespace, any XML Schema tags must be qualified with the namespace prefix.
Background image of page 10
New Perspectives on XML, 2nd Edition Tutorial 4 11 XP UNDERSTANDING DATA TYPES XML Schema supports two data types: built-in and user- derived. A built-in data type is part of the XML Schema specifications and is available to all XML Schema authors. A user-derived data type is created by the XML Schema author for specific data values in the instance document.
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 4 12 XP DECLARING AN ATTRIBUTE An attribute is another example of a simple type. The syntax to define an attribute is <xs:attribute name=" name " type=" type default=" default “ fixed=" fixed " /> Where name is the name of the attribute, type is the data type, default is the attribute’s default value, and fixed is a fixed value for the attribute.
Background image of page 12
New Perspectives on XML, 2nd Edition Tutorial 4 13 XP ASSOCIATING ATTRIBUTES AND ELEMENTS The basic structure for defining a complex type element with XML Schema is
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 50

Tutorial.04 - TUTORIAL 4 XP WORKING WITH SCHEMAS New...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online