Home arrow XML arrow Designing Your own XML Schema: Learn the Essentials

Designing Your own XML Schema: Learn the Essentials

This is the first article in a series which guides you in designing XML Schemas right from the basics without any hurdles.

Author Info:
By: Jagadish Chaterjee
Rating: 4 stars4 stars4 stars4 stars4 stars / 22
March 06, 2006
  1. · Designing Your own XML Schema: Learn the Essentials
  2. · XML Schema: beginning with the simplest way
  3. · XML Schema: the complex way
  4. · XML Schema: a simple practical example
  5. · XML Schema: a simple practical example continued
  6. · XML Schema: a more practical example

print this article

Designing Your own XML Schema: Learn the Essentials
(Page 1 of 6 )

What is XML Schema and why does it exist?

XML documents (or files with the extension “.xml”) are designed with no rules and regulations by default.  Don’t be misled by the phrase “no rules and regulations.”  In this sense, I mean that it is “highly customizable.”  That means no one in this world can constrain or stop you from defining your own “markup” language.  You can start with your own elements, attributes, and values along with your own structure.

But any “customized markup” should have a particular structure, which should be easily understood by existing platforms.  If you design your own markup and hand it to another person to extend it, the next person should conform to all of your “rules and regulations” in extending your markup.  This is simply not possible with oral communications. 

There needs to be some type of language, which should express “all of your rules and regulations” for defining and using your own markup.  The language needs to describe or express the structure of your markup and several other constrainable features being used in your XML document, like data types, nesting, repetition, and so on. In the past, to deal with all of these issues, we had DTD (Document Type Definition).  And now, we have “XML Schema” (which itself is defined in the form of an XML document).

XML Schema is a language for describing the structure and constraining the contents of XML documents.  A schema guarantees that the XML elements linked to it follow the defined structure.  It is always suggested (or strongly recommended) to design and work with XML Schema, before starting to work with XML documents straight away, so that the XML documents would be easily validated.

To validate an XML document against XML Schema, we need to have certain XML parsers or engines to start with.  Most of the parsers are generally written in Java, and several of them are free to use.  MSXML is the XML parser from Microsoft, which is also free.  MSXML is automatically installed if you have Internet Explorer 5.5 or above.

If you wanted to design your XML (or schema) with intelli-sense and several other features (such as XSL, XPath, XQuery, and so on), there are beautiful and productive tools such as “XMLSpy”  (http://www.xmlspy.com/) and “StylusStudio” (http://www.stylusstudio.com/). But you need to buy them :(

For this series of these articles, I used the xml-processing tool “AltovaXML” (also from the “XMLSpy” guys) which is freely downloadable at http://www.altova.com/altovaxml.html.  Even though it is not a GUI based tool, we can operate it from a command line or integrate it with our own Java application, or even integrate it with a .NET application as well.  It is really one of my favorites.

Now let us start working with XML Schemas.

blog comments powered by Disqus

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials