Please visit our sponsors !
XML Schemas - Why?
There are a number of reasons why XML Schema is better than DTD.
XML Schema has Support for Data Types
One of the greatest strength of XML Schemas is the support for data types.
With the support for data types:
- It is easier to describe permissible 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.
Because XML Schemas are written in XML:
- You don't have to learn another language
- You can use your XML editor to edit your Schema files
- You can use your XML parser to parse your Schema files
- You can manipulate your Schema with the XML DOM
- You can transform your Schema with XSLT
XML Schemas Secure Data Communication
When data is sent 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 1999-03-11 might (in some countries) be interpreted as 3. November
or (in some other countries) as 11. March, but an XML element with a data type
like this:
<date type="date">1999-03-11</date>
ensures a mutual understanding of the content because the XML data type date
requires the format CCYY-MM-DD.
XML Schemas are Extensible
XML Schemas are extensible, just like XML, because they are written in XML.
With an extensible Schema definition you can:
- Reuse your Schema in other Schemas
- Create your own data types derived from standard types
- Reference multiple schemas from the same document
Well-Formed is not Enough
A well-formed XML document is a document that conforms to the XML syntax
rules:
- must begin with the XML declaration
- must have one unique root element
- all start tags must match end-tags
- XML tags are case sensitive
- all elements must be closed
- all elements must be properly nested
- all attribute values must be quoted
- XML entities must be used for special characters
Even if documents are Well-Formed they can still contain errors, and those errors can have serious consequences.
Think of this 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.
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|