YouTip LogoYouTip

Schema Why

# Why Use XML Schemas? * * * XML Schema is more powerful than DTD. * * * ## XML Schema Supports Data Types One of the most important capabilities of XML Schema is its support for data types. ### Through Support for Data Types: * It’s easier to describe allowed document content * It’s easier to validate data correctness * It’s easier to work with data from databases * It’s easier to define data constraints (data facets) * It’s easier to define data models (or data formats) * It’s easier to convert data between different data types Editor’s Note: Data constraints, or facets, are a term in XML Schema that can be translated into Chinese as β€œfaces,” used to constrain the allowable values of data types. * * * ## XML Schema Uses XML Syntax Another important feature of XML Schema is that they are written in XML. ### Writing XML Schema in XML Has Many Benefits: * No need to learn a new language * You can use an XML editor to edit Schema files * You can use an XML parser to parse Schema files * You can process Schema through XML DOM * You can transform Schema through XSLT * * * ## XML Schema Protects Data Communication When data is sent from the sender to the receiver, the key point is that both parties should have the same β€œexpectations” about the content. With XML Schema, the sender can describe the data in a way that the receiver can understand. For example, the data β€œ03-11-2004” might be interpreted as November 3rd in some countries and as March 11th in others. However, an XML element with a data type, such as 2004-03-11, ensures consistent understanding of the content because the XML data type β€œdate” requires the format β€œYYYY-MM-DD.” * * * ## XML Schema Is Extensible XML Schema is extensible because they are written in XML. ### Through Extensible Schema Definitions, you can: * Reuse your Schema in other Schemas * Create your own data types derived from standard types * Reference multiple Schemas in the same document * * * ## Being Well-Formed Is Not Enough
← Schema HowtoSchema Intro β†’