What is XML Schema and what is it used for?
Submitted by admin on Thu, 2005-12-15 06:31.
A DTD cannot easily be converted into a CREATE TABLE statement as DTD's only describe character data. The W3C defined a XML language called XML Schema that can better describe data (with propper data types).
XML Schemas can easily be converted into CREATE TABLE statments. Look at this example:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="FAQ-LIST"> <xs:annotation> <xs:documentation>Example XML schema</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence maxOccurs="unbounded"> <xs:element name="QUESTION"> <xs:complexType> <xs:sequence> <xs:element name="QUERY"/> <xs:element name="RESPONSE"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Note: It is quite difficult to compile XML Schemas by hand. Best would be to get a tool like XMLSpy to help you getting the job done.
»
- Login to post comments

