R4R provide basic XMLSchema Tutorials concept with XMLSchema Examples .Through R4R you can develop XMLSchema programming concept. R4R provide XMLSchema Interview Questions with answers.R4R provide XMLSchema Languages study materials in easy way.
XML Schema is an XML schema language recommended by W3C (World Wide Web Consortium) in 2001.An XML schema represents the interrelationship between the attributes and elements of an XML object (for example, a document or a portion of a document). An XML schema is a set of rules to which an XML document must conform in order to be considered 'valid' according to that schema.
To create a schema for a document, you analyze its structure, defining each structural element as you encounter it. For example, within a schema for a document describing a Web site, you would define a Web site element, a Web page element, and other elements that describe possible content divisions within any page on that site. Just as in XML and HTML, elements are defined within a set of tags.
XML Schema 1.0 specifications is divided into 3 parts and available at W3C web site
- XML Schema 1.0 is designed to validate XML 1.0 documents.
- XML Schema 1.0 is an XML based language. XSD documents are XML documents.
- XML Schema 1.0 supports data types.
XML Schema is an XML-based language. it is used to XML-based languages and create data models. An XML schema Discribe element and attribute names for a class of XML documents. The schema also specifies the structure that those documents must adhere to and the type of content that each element can hold.
XML documents that attempt to adhere to an XML schema are said to be instances of that schema. If they correctly adhere to the schema, then they are valid instances. This is not the same as being well formed. A well-formed XML document follows all the syntax rules of XML, but it does necessarily adhere to any particular schema. So, an XML document can be well formed without being valid, but it cannot be valid unless it is well formed.
An XML schema define the structure or model of an XML instance document by defining what each element must or may contain. An element is limited by its type. For example, an element of complex type can contain child elements and attributes, whereas a simple-type element can only contain text. This diagram below gives a first look at the types of XML Schema elements

- In The Structure Of Xml Schema Elements can be of simple type or complex type.
- Simple type elements can only contain text. They can not have child elements or attributes.
- All the built-in types are simple types (e.g, xs:string).
- Schema authors can derive simple types by restricting another simple type. For example, an email type could be derived by limiting a string to a specific pattern.
- Simple types can be atomic (e.g, strings and integers) or non-atomic (e.g, lists).
- Complex-type elements can contain child elements and attributes as well as text.
- By default, complex-type elements have complex content, meaning that they have child elements.
- Complex-type elements can be limited to having simple content, meaning they only contain text. They are different from simple type elements in that they have attributes.
- Complex types can be limited to having no content, meaning they are empty, but they have may have attributes.
- Complex types may have mixed content - a combination of text and child elements
- XML Schema provides a powerful mechanism for specifying datatypes for XML elements and attributes.
- Integration & Accessibility.
- XML Schema’s support for namespaces enables XML documents to contain unique identifiers, and therefore incorporate more than one commonly used vocabulary at a time.
XML | DTD |
XML Schema is namespace aware | while DTD is not |
XML Schemas are written in XML | while DTDs are not |
XML Schema is strongly typed | while DTD is not |
XML Schema has a wealth of derived and built-in data types | that are not available in DTD. |
XML Schema does not allow inline definitions | while DTD does |