XML and Application Integration: Dr. Amor Lazzez
XML and Application Integration: Dr. Amor Lazzez
502510-3/Systems-Integration
Week 8
1
02/05/2015
XML: Elements
<?xml version=“1.0” standalone=“yes”> Version Declaration
Attribute
<conversation date=“12/12/06”> Starting tag
Root element <greeting>Hello, world!</greeting>
Nested elements
<response>Stop the planet, I want to get off!</response>
</conversation> Ending tag
• Elements
– Basic building blocks of an XML document
• Defined by tags
– Starting tag and an ending tag
• Root element
– Outermost element in the XML document
• XML supports nested elements
– Elements within elements
– This ability allows XML to support hierarchical structure
• Element names describe the content of the element
• Structure describes the relationship between the elements
• Attributes of an element
– Describe characteristics of the elements in the beginning tag of an element
2
02/05/2015
XML Schema
3
02/05/2015
XML Parsers
• XML parsers reads XML document and extracts the data for
access by another program
• Document Object Model (DOM) - Tree-based API
• Simple API for XML (SAX) – event based API
<customer>
Begin
<name>Joe Blogs</name>
Joe Blogs
<customer_no>1 </customer_no>
Parser 1
<address>1111 Main St.</address>
1111 Main St.
<city>Someplace</city>
Someplace
<zip>11111</zip>
11111
</customer>
End
4
02/05/2015
XML Namespaces
• A namespace is a collection of names that may be used in an XML
document as elements or attribute names
– Identify names with a particular domain and avoid redundancy
– Allow use of the same name with two different meanings
• Namespaces are identified by a Uniform Resource Indicator (URI)
– Which allows each namespace to be unique
• Example – we may have three elements known as “account”
– Frequent-flyer account
– Bank account
– Customer account at hotel
– Each account name is associated with a particular domain
• Airline URI (http://www.airline.org)
– Associate the element with a particular namespace
• http://www.airline.org.account
• The importance of XML namespace in the context of application
integration is their ability to define common application semantics
between trading partners
What is XSLT?
• Extensible Stylesheet
Language Transformations
(XSLT)
– Language designed to
transform one XML document
into another changing both its
schema and content in the
process
– At its most primitive, it is text-
processing system
– Can generate other standard
markup languages
• XSLT provides a standard XML
document-transformation
mechanism using a stylesheet
as a common processing
engine
Fiction Joy of Integration Joe Smith
Non-Fiction Integration for Dummies John Doe
5
02/05/2015
XSLT Mechanism
• Transforming an XML
document using XSLT
requires two main steps
1. Structural transformation
– Data is transformed from the input
structure to the output structure
– Involves selecting data, grouping it,
sorting it, or aggregating it
XSLT Processors
• XSLT processors apply an
XSLT style sheet to an XML
source document and thus
create a resulting document
– While remaining consistent with
the way processors handle
XML through trees
• XSLT must process three
tress
– Input tree
– Stylesheet tree
– Output tree
• Stylesheet document defines
the transformation to occur
– XSLT processor uses
stylesheet tree to transform the
input tree to the output tree
6
02/05/2015
SAP PDF
XSLT
XML XML
Custom
Application
HTML
Data
7
02/05/2015
8
02/05/2015