An XML Schema describes the structure of an XML document.
The XML Schema Working Group is closed, having completed its work successfully. The specifications are now maintained by the W3C XML Core Working Group.
https://www.w3.org/XML/Schema
The XML Schema language is also referred to as XML Schema Definition (XSD).
The purpose of an XML Schema is to define the legal building blocks of an XML document:
- the elements and attributes that can appear in a document
- the number of (and order of) child elements
- data types for elements and attributes
- default and fixed values for elements and attributes
Why Learn XML Schema?
In the XML world, hundreds of standardized XML formats are in daily use.
Many of these XML standards are defined by XML Schemas.
XML Schema is an XML-based (and more powerful) alternative to DTD (Document Type Definition).
XML Schemas Support Data Types
One of the greatest strength of XML Schemas is the support for data types.
- It is easier to describe allowable document content
- It is easier to validate the correctness of data
- It is easier to define data facets (restrictions on data)
- It is easier to define data patterns (data formats)
- It is easier to convert data between different data types
XML Schemas use XML Syntax
Another great strength about XML Schemas is that they are written in XML.- You don't have to learn a new language
- You can use your XML editor to edit your Schema files
- You can use your XML parser to parse your Schema files
- You can manipulate your Schema with the XML DOM
- You can transform your Schema with XSLT
- XML Schemas are extensible, because they are written in XML.
With an extensible Schema definition you can:
- Reuse your Schema in other Schemas
- Create your own data types derived from the standard types
- Reference multiple schemas in the same document
XML Schemas Secure Data Communication
When sending data from a sender to a receiver, it is essential that both parts have the same "expectations" about the content.With XML Schemas, the sender can describe the data in a way that the receiver will understand.
Ref. http://www.w3schools.com/xml/schema_intro.asp
https://en.wikipedia.org/wiki/XML_schema
XSD How To?
XML documents can have a reference to a DTD or to an XML Schema.A Simple XML Document
Look at this simple XML document called "note.xml":<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
The first line defines the note element to have four child elements: "to, from, heading, body".
An XML Schema
The following example is an XML Schema file called "note.xsd" that defines the elements of the XML document above ("note.xml"):<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The note element is a complex type because it contains other elements.
The other elements (to, from, heading, body) are simple types because they do not contain other elements.
A Reference to an XML Schema
This XML document has a reference to an XML Schema:<?xml version="1.0"?>
<note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Example
Here are some XML elements:
<lastname>Refsnes</lastname>
<age>36</age>
<dateborn>1970-03-27</dateborn>
And here are the corresponding simple element definitions:
<xs:element name="lastname" type="xs:string"/>
<xs:element name="age" type="xs:integer"/>
<xs:element name="dateborn" type="xs:date"/>
Example of an attribute
Here is an XML element with an attribute:
<lastname lang="EN">Smith</lastname>
And here is the corresponding attribute definition:
<xs:attribute name="lang" type="xs:string"/>
XSD Restrictions/Facets
Restrictions are used to define acceptable values for XML elements or attributes. Restrictions on XML elements are called facets.
Restrictions on Values
The following example defines an element called "age" with a restriction. The value of age cannot be lower than 0 or greater than 120:
<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="120"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
http://www.w3schools.com/xml/schema_intro.asp
XSD - The <schema> Element
The <schema> ElementThe <schema> element is the root element of every XML Schema:
<?xml version="1.0"?>
<xs:schema>
...
...
</xs:schema>
http://www.w3schools.com/xml/schema_schema.asp
List of some XML Schema
Libraries- EAD, for encoding archival finding aids, maintained by the Technical Subcommittee for Encoded Archival Description of the Society of American Archivists, in partnership with the Library of Congress.
- MARCXML, a direct mapping of the MARC standard to XML syntax.
Metadata
- RDF - Resource Description Framework
- ONIX for Books - ONline Information eXchange, developed and maintained by EDItEUR jointly with Book Industry Communication (UK) and the Book Industry Study Group (US), and with user groups in Australia, Canada, France, Germany, Italy, the Netherlands, Norway, Spain and the Republic of Korea.
- DDML - reformulations XML DTD
- PRISM - Publishing Requirements for Industry Standard Metadata (PRISM)
Publishing
- JATS (formerly known as the NLM DTD)—Journal Article Tag Suite, a journal publishing structure originally developed by the United States National Library of Medicine
- DITA—Darwin Information Typing Architecture, document authoring system
- DocBook for technical documentation
- PRISM - Publishing Requirements for Industry Standard Metadata (PRISM)
XML Standards Library compilation
http://schemas.liquid-technologies.com/
TEI-XML
example HALhttps://github.com/CCSDForge/HAL/blob/master/Sword/COUV.xml
No comments:
Post a Comment