XML Schema (XSD)
When beginning a study of XML, some may encounter an unfamiliar term that leaves them asking the question, “What is an XML schema (XSD)?” An XML schema is a road map for the XML document similar to a Document Type Definition (DTD). Created by the World Wide Web Consortium (W3C), schemas describe the elements and map out the presentation and nesting of XML documents. Essentially, the schema enables all applications to understand the flow of the page and validate the elements.
Why Use An XML Schema?
Step away from websites for a minute and consider house building. If the plumber, electrician and contractor all do their own thing, the result is a building with an uneven line, sinks in the bedroom and cable hookups in the bathroom. That does not happen because the architect draws a diagram that maps out the basic structure. With a blueprint, there is no guesswork. The plumber understands where the sinks go, and the electrician knows what rooms need what type of wiring. A schema is the blueprint of an XML document. Since XML works to move data, it is essential that the sender and the receiver of this data both understand the content.
Why not Write a DTD Instead?
A DTD will do the same thing. While there are many differences between a DTD and the schema, both serve to provide instruction for XML. Writing a DTD means learning a new set of rules and syntax. However, a schema is written in XML. From a developer's standpoint, because schemas are XML documents, they can be parsed just like any XML file. One other significant difference between these two document formats is the data type. In a DTD, a zip code is text. That is the only way to define it. In a schema, an author could establish a different definition for the element ‹zip› by setting up a data type. This means that you tell the parser, data strings under the element ‹zip› must follow a set pattern.So, let’s answer some of the basic questions regarding XML schemas:
What is an XML Schema?
A schema is a blueprint of an XML document that defines the elements, data types and nesting structure of the page.
Why use an XML Schema?
Schemas allow all applications to understand the rules and content of the page.
Why not write a DTD instead?
You could write a DTD for an XML page and accomplish some of the same goals. However, because a schema is written in XML, there is no new syntax or rules to understand. If you can write a page in XML, you can write an XML schema.
Source:www.about.com
Why Use An XML Schema?
Step away from websites for a minute and consider house building. If the plumber, electrician and contractor all do their own thing, the result is a building with an uneven line, sinks in the bedroom and cable hookups in the bathroom. That does not happen because the architect draws a diagram that maps out the basic structure. With a blueprint, there is no guesswork. The plumber understands where the sinks go, and the electrician knows what rooms need what type of wiring. A schema is the blueprint of an XML document. Since XML works to move data, it is essential that the sender and the receiver of this data both understand the content.
Why not Write a DTD Instead?
A DTD will do the same thing. While there are many differences between a DTD and the schema, both serve to provide instruction for XML. Writing a DTD means learning a new set of rules and syntax. However, a schema is written in XML. From a developer's standpoint, because schemas are XML documents, they can be parsed just like any XML file. One other significant difference between these two document formats is the data type. In a DTD, a zip code is text. That is the only way to define it. In a schema, an author could establish a different definition for the element ‹zip› by setting up a data type. This means that you tell the parser, data strings under the element ‹zip› must follow a set pattern.So, let’s answer some of the basic questions regarding XML schemas:
What is an XML Schema?
A schema is a blueprint of an XML document that defines the elements, data types and nesting structure of the page.
Why use an XML Schema?
Schemas allow all applications to understand the rules and content of the page.
Why not write a DTD instead?
You could write a DTD for an XML page and accomplish some of the same goals. However, because a schema is written in XML, there is no new syntax or rules to understand. If you can write a page in XML, you can write an XML schema.
Source:www.about.com
Comments
Post a Comment