XML Schema

Introduction to XML Schema

XML Schema is a W3C Standard. It is an XML-based alternative to DTDs. It describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition (XSD).

In this section, you will learn how to read and create XML Schemas, why XML Schemas are more powerful than DTDs and how to use them in your application. Very soon XML Schemas will be used in most Web applications
as a replacement for DTDs. Here are some reasons:

• XML Schemas are extensible to future additions
• XML Schemas are richer and more powerful than DTDs
• XML Schemas are written in XML, supports data types and namespaces.

What is an XML Schema?

XML Schema is used to define the legal building blocks of an XML document, just like a DTD. An XML Schema defines user-defined integrants like elements, sub-elements and attributes needed in an xml document. It defines the data types for elements and attributes along
with the occurrence order. It defines whether an element is empty or can include text. It also defines default and fixed values for elements and attributes

Why Use XML Schemas?

XML Schemas are much more powerful than DTDs.

Features of XML Schemas:

XML Schemas Support Data Types One of the greatest strengths of XML Schemas is its support for data types. With support for data types:


• It is easier to describe allowable document content
• It is easier to validate the correctness of data
• It is easier to work with data from a database
• It is easier to define data facets (restrictions on data)
• It is easier to define data patterns (data formats)
• It is easier to convert data between different data types

XML Schemas use XML Syntax

Another great strength about XML Schemas is that they are written in XML. Simple XML editors are used to edit the Schema files. Even the same XML parsers can be used to parse the Schema files.

XML Schemas are Extensible

XML Schemas are extensible, because they are written in XML. So a user can reuse a Schema in other Schemas and can also refer multiple schemas in the same document. He can also create his own data types derived from the standard types.

Well-Formed is not enough alone

A well-formed XML document is a document that conforms to the XML syntax rules. Even if documents are well formed they can still contain errors, and those errors can have serious consequences.

Think of the following situation: you order 5 gross of laser printers, instead of 5 laser printers. With XML Schemas, most of these errors can be caught by your validating

XML Schemas Secure Reliable Data Communication

When sending data from a sender to a receiver, it is essential that both parts have the same “expectations” about the content. With XML

Feb 2008 | Java Jazz Up | 16
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 ,

Download PDF