Validity of XML Document

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email
We have already discussed about valid documents in the second chapter. Saying that a document is "valid" means that it fits within the described model of a class of documents. If you are setting up a business to business process with another company and if you have agreed to share information from your partners, database,

you can validate the validity of the data using your XML schema. Invalid data formats can be rejected before they are inserted into your database.

Using a schema and a validating parser offers a standard way to test your documents. Every document that you encounter can be defined in one of four ways:

An XML document is not well formed.

An XML document may be simply well formed if it does not identify a schema to which it claims to conform.
An XML document may be well formed but not a valid one if the document does not fit within the model described by that schema.

An XML document may be well formed and a valid one if a schema is associated with the document, and the document does not violate any of the constraints of that schema.

There are basically two types of validity namely:
Content Model Validity and

Datatype Validity.

<b>Content Model Validity</b>

Content model validity tests whether the order and nesting of tags is correct or not. A LIB, for example, might be defined as having a required <TITLE> tag, one <AUTHOR> tag, a required <ISBN>, and a <PUBLISHER> tag.

In the XML schema syntax, the content model of an address could be described like this:
An XML document with LIB element should meet the above criteria failing which it would be invalid.
<b>Data Type Validity</b>
Datatype validity is the ability to test whether specific units of information are of the correct type and fall Within the specified legal values. For example, in the above schema, the ISBN number has constraint that, it should contain only numbers with hyphens separating the first and the second digits and the fourth and the fifth digits. The ability to express datatype validity in a schema is one of the really new features of the XML schema. DTDs have extremely limited datatyping.

<b>Syntax</b>

XML schema documents are XML documents. This means that they use elements and attributes to express the semantics of the schema and that they can be edited and processed with the same tools that are used to process other XML documents. Vocabulary of an XML schema document comprises about thirty elements and attributes At the bottom, a schema describes the content of elements and attributes. Let us examine how our LIB element is declared in a schema.

The LIB Element Type

<elementType name= " LIB " >

<mixed/>

</elementType>

This example defines the LIB element type. The term 'element type' is used to differentiate the actual element and the type of the element. The content of the <elementType> element defines the valid content of an element of that type. In the above example, the content type is <mixed/>which means that both characters and other element types can be part of the LIB element's contents.

Now let us examine how an ISBN datatype is declared using the XML schema. This actually demonstrates the datatyping power of an XML schema. The ISBN datatype is a string, which contains exactly ten digits with hyphens separating the first and the second elements and the fourth and the fifth elements.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.