SOA Basics – Introduction to XML

SOA Basics – Introduction to XML

Introduction to XML

XML stands for eXtensible Markup Language and is
designed to transport and store data. </strong >

<Author>W3 Schools</Author>
<Price currency=”USD”>5.99</Price>
<Name>SOA Suite 11g Essentials</Name>
<Author>W3 Schools</Author>
<Price currency=”USD”>19.99</Price>


XML Syntax

XML is used in many aspects of web development, often to simplify
data storage, transport and sharing.

XML documents form a tree structure that starts at “the root” and branches
to “the leaves”. Note in the above Example, you have Library that is the
“root” element with leaf elements “Book” and sub-child “Name”, “Author”,
“Date” etc.

The syntax rules of XML are very simple and logical. The rules are easy to
learn, and easy to use.

    • All XML Elements Must Have a Closing Tag
    • XML Tags are Case Sensitive
    • XML Elements Must be Properly Nested
    • XML Documents Must Have a Root Element
    • XML Attribute Values Must be Quoted
    • Entity References

 </strong >XML Element

 </strong >An XML element is everything from (including) the element’s start tag to
(including) the element’s end tag.

 </strong >An element can contain:

    • other elements
    • text
    • attributes
    • or a mix of all of the above…

 </strong >XML elements must follow these naming rules:

  •  </strong >Names can contain letters, numbers, and other characters
  • Names cannot start with a number or punctuation character
  • Names cannot start with the letters xml (or XML, or Xml, etc)
  • Names cannot contain spaces

XML Attributes

XML elements can have attributes, just like HTML. Attributes provide
additional information about an element. Attributes often provide
information that is not a part of the data. In the example below, the file
type is irrelevant to the data, but can be important to the software that
wants to manipulate the element:

In the E.g. XML above, you notice that the “currency” is attribute about the
“Price” element

XML Namespaces

XML Namespaces provide a method to avoid element name conflicts. Lets take
an example of the following two XML’s

If these XML fragments were added together, there would be a name conflict.
Both contain a <table> element, but the elements have different
content and meaning.

Use Prefix to resolve such a conflict.A well formed XML should refer to its
element and content without any ambiguity. In the above example, there are
two table, one table is furniture and another table is container to hold


When using prefixes in XML, a so-called namespace for the prefix must be
defined. The namespace is defined by the xmlns attribute in the start tag of
an element. The namespace declaration has the following syntax.
<f:table xmlns:f=””>
<c:table xmlns:c=””>

In the example above, the xmlns attribute in the <table> tag give the
f: and c: prefixes a qualified namespace. When a namespace is defined for an
element, all child elements with the same prefix are associated with the
same namespace.

Namespaces can be declared in the elements where they are used or in the XML
root element:

<?xml version=”1.0″?>
<root  xmlns:f=””
<c:table >

An XML Schema describes the structure of an XML document.What is XML schema?

<?xml version=”1.0″?>
<xs:schema xmlns:xs=”; xmlns:lib=”” targetNamespace=””xmlns:book=””>
<xs:import location=”./booktype.xsd” xmlns=””>
<xs:complexType name=”MfgInfoType”>
<xs:element name=”MfgName” type=”xs:string”/>
<xs:element name=”Library”>
<xs:element name=”Book” type=”book:BookType”/>
<xs:element name=”Mfg” type=”lib:MfgInfoType”/>

An XML Schema:The purpose of an XML Schema is to define the legal building
blocks of an XML document, just like a DTD.

  • defines elements that can appear in a document
  • defines attributes that can appear in a document
  • defines which elements are child elements
  • defines the order of child elements
  • defines the number of child elements
  • defines whether an element is empty or can include text
  • defines data types for elements and attributes
  • defines default and fixed values for elements and attributes

Comparison between RDBMS and XML

Row in tableXML Document
TableXML Schema
SQLXPATH Queries (E.g. /Library/Book[1]/Name)
Data Manipulations / PLSQLXSL – Transformation

Other Topics


Copyright © 2020 BTSS Corp.