What is an XML Schema?
XML Schema Definition Language, XSDL, is used to enforce rules on data structures within XML files. The Schema Definition Language ensures that each object within the XML file conforms to a predefined structure as described within the XSDL document.
XML Schemas facilitate the creation of significantly complex data structures. Essentially, the XSD files themselves are simple files which would be legible to any basic programmer. They define elements within the object in terms of variables which have data types, such as string, integers and floating point numbers.
There are various XSD Editors on the market at present, the most obscure, yet well known is Microsoft Word. MS Word allows basic XML Editing, exporting, and even inclusion of XSDL Schema files so that you can check whether your document conforms to the correct standards.
There are other paid alternatives, which offer graphical XML and XSD Editing, for more hands on development tasks. For tasks which involve large amounts of XML Editing, I’d recommend purchasing some quality software. Bearing this in mind, you won’t have to purchase any software if you’re just getting started with XML, as you probably already have it.
If you’re looking for a way to learn XML Schemas, search Google for some short tutorials, or purchase a book from somewhere like Amazon.
XML Style sheet Transformation Language XSLT is not the same as XSDL. XSLT is a transformations language which transforms XML Data to another format, such as HTML for web rendering. XSDL forces data integrity throughout this process, but will not alter data during this.
Schemas are actually XML Documents too, and they must conform to the legal boundaries of a schema specification, which is known as a ’schema schema’. Schemas themselves can be imbedded in the files, (for example XML, HTML). Now it has started getting complicated, the need for an XML Editor is apparent! Ideally, XML and XSD Editors are necessary for editing these files of modest complexity.
To understand schemas in detail, you really should do a little background reading in XML Prefixes and XML Namespaces. Again, reading on these can be found on Google (or Amazon if you’re old school). XML Documents attach the URI of the Schema on the second line, by using the tag:
In this example, the XML file would generally be about a set of contacts, with the root element being defined as a ‘Contact’ i.e. < xs:element name=” Contact”>
Root elements are usually defined as complex type as they can contain numerous data types and objects within them. Within root elements, there is a ’sequence’ of child objects. The available data types for these are; “element”, “simpleType”, “complexType”, “date”, “integer”, to name just a few. Within XML Schema Documents, you may often see elements with a prefix ‘xs:‘, or ‘xsd:‘, this is a standard to define schema tags.