Introduction to XML Schema

In this tutorial 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.

Ads

Tutorials   
JAXB Create XML File And Get Data From XML XML,XML Tutorials,Online XML Tutorial,XML Help Tutorials The Simple API for XML (SAX) APIs Part I XML,XML Tutorials,Online XML Tutorial,XML Help Tutorials XML Tutorial Ignoring Comments While Parsing an XML File Accessing XML file from Java Preventing Expansion of Entity References Getting next Tag in the XML File Replacing a Node with a New One Reading XML Data from a Stream Reading an XML document using JDOM Query XML with an XPath expression Normalize All of the Text in a Document Modifying Text by Replacement Insert a Processing Instruction and a Comment Node Getting text values from a NodeList Finding an ID Value and Print the Element Text Edit Text by Insertion and Replacement Duplicating a Subtree Deleting Two Attributes Delete the First Child of the Root Node Creating XML Tree Creating a DocumentFragment Subtree and Appending it to the Document Creates element node, attribute node, comment node, processing instruction and a CDATA section Creates a New DOM Parse Tree Replacing a Text Node with a New CDATA Section Node Create an Empty DOM Document Adding an Attribute in DOM Document Transforming XML with XSLT Transforming an XML File with XSL Transforming XML with SAXFilters Storing properties in XML file Testing EntityReferences in Xml Splitting One Text Node into Three Reading XML from a File Modifying Text by Cutting and Pasting Locating a Node by Using Siblings Locate a Node and Change Its Content Loading properties from a XML file Listing nodes used in a document Inserting a New Entry in a List Creating an InlineStreamFilter Ignoring Comments While Parsing an XML File Handling Errors While Parsing an XML File Emitting DOCTYPE Declaration while writing XML File Converting CDATA Nodes into Text Nodes Java DOM Tutorial Creating Blank DOM Document
Ads

Introduction to XML Schema

     

In this tutorial 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.

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).

We think that 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  a 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 software.

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 Schemas, the sender can describe the data in a way that the receiver will understand. A date like: "03-11-2004" will, in some countries, be interpreted as 3.November and in other countries as 11.March.However, an XML element with a data type like this: <datetype="date">2004-03-11</date> ensures a mutual understanding of the content, because the XML data type "date" requires the format "YYYY-MM-DD".

     

Advertisements

Share on Google+Share on Google+

Introduction to XML Schema

Posted on: May 25, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Introduction to XML Schema   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
krishna mohan
June 2, 2011
java

very good documents

Ads

 

Ads