Friday, March 19, 2010

XML Schema XSD


XSD is a placeholder or a base over which you build your data.Its a structure definition which even includes validation.

Over XSD many more XML technologies have been built.
My motive of teaching you XSD is to give you a fair idea to enter the Fusion Apps and learning Oracle SOA Suite 11g.

An example XSD:

Scenario: A class has multiple students and each student has enrolled in multiple subjects.
How do I make a schema which suffices my need?

XSD basically has 3 sections.

1. Like java.lang API, you need some basic datatypes of your elements to be available in your XSD.
xmlns="http://www.w3.org/2001/XML Schema" fetches those basic datatypes
in your schema.

2. Like a java program belongs to a package, so that its components become reusable, XSD too has a placeholder, where all its definitions reside, its called targetNamespace.

targetNamespace="http://www.pknag.co.cc"

3. When you define your own complex datatypes in your xsd and you want to refer it uniquely, you need a pointer to your complex and simple types.

Example , I say xmlns:abc="http://www.pknag.co.cc"

Lets see our example in action now.
===================================================================

=================================================================
Open this snippet in some IDE like Oracle Jdeveloper and you can see in the design view, how it looks.