Beruflich Dokumente
Kultur Dokumente
Description: BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Beginners Guide for Oracle SoA. The document focuses on basic keywords, terminology and definitions one should know before starting Oracle SoA. Join our professional training program and learn from experts.
Description Change Author Initial Draft Shiva Kant Pandey Review#1 Amit Sharma
www.bisptrainigs.com
www.hyperionguru.com
Page 1
PART III :
EXAMPLES ON
XSD
How to use following in xsd: Import include ref Block = #all Abstract
Below are the examples we are going to use 1. Student.xsd 2. Science Student.xsd 3. ArtStudent.xsd Also learn how to generate XML from XSD.
EXAMPLE 1. Student. XSD Step 1: Create a new xsd file under project click xsd--> file name --> Target Namespace-->prefix -->ok now created successfully Student.xsd as shown in figure
www.bisptrainigs.com
www.hyperionguru.com
Page 2
Step 2: After creating new xsd i.e student .xsd it can be easily seen under project under xsd as shown
Prefix used is stdobj. Registered namespace Target namespace is shown under registration . Now start writing xml in xsd i.e <xsd:element name ="Student" type="StudentType"></xsd:element> In this statement we have defined Student as element & stdobj:StudentType as its type. Here stdobj is prefix & is used so that parser can identified uniquely each element.
Here StudentType is ComplexType xsd & so it contains a group of elements (Name, Number, Email, Lang1Marks,Lang2 Marks,Lang3MArks ) & these elements are again defined by their types ex. string , integer.
www.bisptrainigs.com
Step 4 : How to convert this Student.xsd into xml form . click on NEW--->All Technologies--->XML --->Xml Document From Xml Schema--->Ok.
www.bisptrainigs.com
www.hyperionguru.com
Page 4
Browse student.xsd file Click on Browse tab Now select location then choose Student.xsd & then ok .
www.bisptrainigs.com
www.hyperionguru.com
Page 5
www.bisptrainigs.com
www.hyperionguru.com
Page 6
Check Target Namespace Check Root Element depth should be 3 select UTF-8 encoding finally click finish. After finish click xml will generate automatically. So this xml is example of student xsd.
NOTE: Similarly later we will create xml from ScienceStudent .xsd & ArtStudent .xsd . Step 5: Create new ScienceStudent.xsd by clicking
Right click xsd--->choose New --->select File Name --> select Target Namespace--> Prefix---> OK .
www.bisptrainigs.com
www.hyperionguru.com
Page 7
NOTE : 1) Target Namespace should be same for each xsd under same project . 2) prefix will change ex: scobj
www.bisptrainigs.com
www.hyperionguru.com
Page 8
Step 6: Create ScienceStudent.xsd here & also include Student.xsd as shown below.
Note: There are two operations include & import . Include is used when we have to include any xsd into other xsd under same project under same xsd for example student.xsd is included by ScienceStudent.xsd under similar project or in similar schema location. Import is used when we have to include any xsd into other xsd under different project & hence we need to either copy the xsd to be imported from its physical location or by ORA MDS (oracle meta data system repository) we will discuss this import in our next docs later. Here in figure we have simply included the Student.xsd into ScienceStudent.xsd by using following syntax
Now use this Student.xsd elements in ScienceStudent.xsd inside its ComplexType . Syntax used is Complex type --> ComplexContent--> extension base (include here student.xsd with its new prefix scobj ) and under Extension we can use we can use <xsd:sequence> & inside it elements .
www.bisptrainigs.com
www.hyperionguru.com
Page 9
Included portion
www.bisptrainigs.com
www.hyperionguru.com
Page 10
Step 9: Create XML Document from XML Schema as discussed before NEW--->All Technologies ---> XML---->XML document From Xml Schema--->Ok
Click next
www.bisptrainigs.com
www.hyperionguru.com
Page 11
click finish
Now xml document created automatically from xml schema. Here notice that this xml is included student xml under Science Student xml.
Step 10 : Create new xsd i.e Art Student.xsd Right click on xsd under project ---> New--->All Technology --->XML---> Xml schema --->ok---> File Name (ArtStudent.xsd) ---> Target namespace (similar) ----> Prefix(artobj)---> OK
www.bisptrainigs.com www.hyperionguru.com Page 12
Here we have referred student.xsd into ArtStudent.xsd & not extending base just referring .
www.bisptrainigs.com
www.hyperionguru.com
Page 13
Step 12: Create xml document from xml schema as discussed earlier.
www.bisptrainigs.com
www.hyperionguru.com
Page 14
Note here since student type is referred & not extended as base & hence student elements are inside student & this student is inside art student.
www.bisptrainigs.com
www.hyperionguru.com
Page 15
Use of Abstract:
ABSTRACT: If abstract = true then no one can use that xsd further i.e it restricts vise versa for false condition USE OF BLOCK #ALL :
www.bisptrainigs.com
www.hyperionguru.com
Page 16
www.bisptrainigs.com
www.hyperionguru.com
Page 17