What are the characteristics of the XML scheme?
XML scheme is a language used to describe the structure of the XML documents. Because of the confusion created between the XML standard scheme W3C and the usage of the same term to describe the general scheme languages, a part of the programmers use the term WXS, while others are using the term XSD to define the schemes.
As any other language used to validate XML, XSD is used to define a set of rules to establish if a XML document is valid or not. The XML documents that adhere to a certain XML structure are instances of the same structure. Remember! A valid instance is not the same thing as a well designed document, as an XML document respects the XML instance, without adhering to an XML scheme. In simple words, XML can be formed without being valid, but it can’t be valid without being formed.
The capacities of the XML Scheme
It is possible to be experienced with DTD. The resembling between this standard and XML scheme is that they both define XML classes.
DTD appeared long before XML, being created to define a standard for the documents written in SGML, the father of XML. Although DTD are still popular, the XML scheme is a stronger language.
Here are a few limits of the DTD language:
- DTD has no predefined data
- DTD doesn’t allow certain type of data to be defined by the user
- DTD permits a limited control over cardinality (the number of appearances of an element in a scheme)
- DTD can’t allow spaces of any kind of re-usage of other schemes
An XML scheme defines the structure of an XML document, defining what it contains or should contain any element. An element is limited by its type. As an example, a complex element can contain child attributes, while a simple element can only contain texts.
In the XML language, you can use predefined types of data, but you can also create your own data. Here is a complex analyze of the types of data.
The elements can be simple or complex. The simple elements can only contain a text. They can’t have child elements or attributes.
All the predefined data are string types
You can create simple types by restricting other simple types. As an example, an email type of data can be derived from strings by stating a specific pattern to the email addresses.
The type of data can be atomic, (string and integer) or non-atomic (lists)
The complex elements can contain child elements or attributes, but also texts.
By default, the complex elements can contain child elements.
The complex elements can be restricted to have simple content (only text). They are different from the simple types as they also have attributes.
The complex elements can have a mixed content, a combination between texts and child elements. As a conclusion, an XML scheme is only an XML document that follows all the XML rules and syntax. The XML schemes must also follow pre defined rules.