Total members 9951 | Gratitudes |It is currently Sat Feb 11, 2012 9:34 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Article
 Article subject: lesson1 : <schema> Element
PostPosted: Tue Feb 17, 2009 11:51 pm 
Offline
Mastermind
User avatar

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 :
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 .

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 Usage of big element tag.  HTML examples  msi_333  0
 removing focus border from a HTML element  HTML examples  msi_333  0
 inherit background color from the parent element  HTML examples  msi_333  0
 print element in 2d matrix  C-C++  sakorian  1
 access element in array C++  C-C++  sakorian  1

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Article | Next Article 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team