Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 56 time
<schema> Element : All XML schema have a common element which is <schema> .<schema> element is the root of your XSD schema .
It looks like this :
Code:
<?xml version="1.1" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.codemiles.com" xmlns="http://www.codemiles.com" > <!-- other elements here --> </xs:schema>
Let us understand what is the meaning of the urls and namespaces in the xml schema :
1 .
Code:
xmlns:xs="http://www.w3.org/2001/XMLSchema"
Means that the datatypes and elements used in this schema comes from this namespace and it should be perfix with "xs" .
2.
Code:
targetNamespace="http://www.codemiles.com"
The new elements defined in this schema comes from this namespace url.
3.
Code:
xmlns="http://www.codemiles.com"
Default namespace ,used if you didn't found the first one .
Once you create your XML schema , you can generate a XML file and put a link to it XML schema as a reference in validation. For example :