Total members 11808 |It is currently Thu Dec 12, 2019 2:13 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





<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 :
xml 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 :
xml code
<?xml version="1.0"?>

<school xmlns="http://www.codemiles.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.codemiles.com school.xsd">

<Name>School number 1</to>
<Location>Near train station</from>
<Size>1000m'2 </heading>

</school>


as you may noticed :
Code:
xsi:schemaLocation="http://www.codemiles.com school.xsd"


Used as a reference to your XML schema .



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : lesson1 : <schema> Element
 define UUID in your XSD schema     -  
 Usage of big element tag.     -  
 Pop the element off the end of array     -  
 UnSet array element     -  
 Array element navigation     -  
 access element in array C++     -  
 print element in 2d matrix     -  
 lesson2 : XSD simple element     -  
 opacity of HTML element- transparent     -  
 Get the position of HTML element using JQuery     -  



Topic Tags

XSD Basics






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com