Introduction to XML in Oracle SOA

  1. XML:

<? XML version =”1.0”?>

<Employees>

<Employee>

<name>saiteja</name>

<Id>2434</Id>

</Employee>

</Employees>

 

 

Note1:

Id not there then instead of <Id>2430</Id> write <Id/>

 

Note2:

  1. XML pay load
  2. XML data
  3. XML document

 

Note 3:

When write the Xml document follow the below instructions

  • Instead of

  1. < -  &lt;
  2. > - &gt;
  3. & - &amp;(ampersand)
  4. “ - &quot;(double quote)
  5. ‘ - &apos(Single quote)

 

10,20 numbers:

<? XML version =”1.0”?>

<Numbers >

<Number >

<Num1 >10</Num1 >

<Num2>20</Num2>

</Number >

</Numbers >

Desired to gain proficiency on Oracle SOA? Explore the blog post on

Oracle SOA Training to become a pro in Oracle SOA.

 

  1. XSD:

<? XML version = “1.0”?>

<Schema>

<element name=”employees”>

<Complex type>

<Sequence>

<element name= “employee”>

<complex Type>

<sequence>

<Element name =”Name”  type =”string”/>

<Element name =”Id”  type =”int”/>

<Element name =”location”  type =”string”/>

</sequence>

</complex Type>

</element>

</sequence>

</complex Type>

</elements>

</Schema>

 

 

XSD:

 It is used to define the data types of respective XML

Validation/ Enumerations/ restrictions in XSD:

<simple type name = “Name type”>

<restriction type/ base= “string”>

<enumeration value =”sai”/>

<enumeration value =”Teja”/>

<enumeration value =”XYZ” />

</restriction>

</simple type>.

  • customer, employee having/wants same data then we are write like this

 

<? XML version = “1.0”?>

<target Name space =”http://TCS.com/add2 numbers”>

<Schema>

<element name=”employees”  Type = “employee Type”/>

<element name=”customer”  Type = “employee Type”/>

<complex Type name=”employee Type/”>

<Sequence>

<element name=”Name”  Type = “string”/>

<element name=”Eid”  Type = “int”/>

</Sequence>

</complex Type>

</element>

</schema>

 

Definitions:

  1. Name space: To avoid the collision (conflict) we will use the “name space” with identifies
  2. Target name space: It is address of XML,XSD

                                           (or)

It is address of any of artefacts -> XML, XSD, XSLT, XQuery, WSDL

  1. Import: It is importing other XSD’s which are having “different T.N.S”.
  2. Include: It is importing other XSD’s which are having “same T.N.S”.
  3. XSD:

 

<? XML version = “1.0”?>

<target Name space =”http://TCS.com/item”>

<Schema>

<element name=”Item”  Type = “Item Type”/>

<complex Type name=”Item Type/”>

<Sequence>

<element name=”item id”  Type = “int”/>

<element name=”price”  Type = “int”/>

</Sequence>

</complex Type>

</element>

</schema>

Learn more about Oracle SOA Interview Questions in this blog post.

  1. Import above XSD into My XSD:

 <? XML version = “1.0”?>

<target Name space =http://oracle.com/customer>

XMlns : item =” http://Tcs.com/item” -

<types>

<import name space =”http://TCS.com/item”> schema location  =”tem.XSD”

</types>

 

  1. Include above XSD(item.XSD) into my XSD:

<? XML version = “1.0”?>

<target Name space =http://TCS.com/customer>

XMlns : item =” http://Tcs.com/item” -

<types>

<nclude schema location = “item .XSD”>

</types>

 

X –path language:

 <? XML version = “1.0”?>

<Customers>

<Customer>

<name> Ramesh </name>

<id> 12345</id>

<loc> hyd</loc>

</Customer>

<Customer>

<name> Ramesh1 </name>

<id> 121121</id>

<loc> bngl</loc>

</Customer>

</Customers>

  1. //* -> Entre XML document/pay load
  2. /customers/customer[2] -> 2nd record from XML document
  3. / customer/customer[2]/loc -> <loc>Ind </loc>
  4. / customer/customer[2]/loc /text() -> Ind
  5. / customer/customer[d>450]/Name/text() -> ABC
  6. / customer/customer[position()<= lost()-1]/id/test -> 49,50

49=50-1

Note: Total records 50

XSD: It is used to defined the data types of respective XML.

For an Indepth knowledge on Oracle SOA click on: