02/05/2015
XML and Application Integration
Dr. Amor Lazzez
Office location: Tarbia Campus (C/ 306)
Phone: 0549071465 (cell)
Email: a.lazzez@gmail.com
502510-3/Systems-Integration
Week 8
The Value of XML
• XML provides a common-data exchange format,
encapsulating both data and metadata
• Promotes a self-defining message structure
– A standard format of information exchange on the Internet
– An infrastructure for information exchange and
management in the world of application integration
• XML provides a robust, human-readable information
exchange standard
– Supports the exchange of application semantics and
information content
– Provides an application-level mechanism for producing
business information
• Applications do not need to understand anything about one other
1
02/05/2015
XML Meets Middleware
• Middleware simply “carries the load”
– It moves messages that encapsulate or abstract XML
– Ensures that those message are understood by any
source or target applications that need the information
• Middleware manage the interfaces with the source
or target application
– Move information into and out of application
– Need necessary changes to source and target
applications to consume and produce XML
• XML demands huge overhead
– XML document uses more bytes than binary message
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
Relationship between XML specifications
XML Schema
XML Schema dictates what can
and cannot be done with XML
data, in same way database
schema establish a structural
model for data they represent.
• XML document is created based on vocabulary of elements
• Vocabularies can be defined formally using a schema
definition language, XML Schema
– Protect integrity of XML document data by providing structure,
validation rules, data type constraints, and inter-element relationships
• Plays an important role as an enterprise data transport
standard as it greatly refines the quality of XML data
• Schema allows authors to establish logical domains to which
some or all parts of a schema can be applied
3
02/05/2015
XML Schema and XML Document
<?xml version=“1.0’?>
<inventory
xmlns=http://www.xmltc.com
xmlns:xsi=http://www.w3.org/2001/
XMLSchema-instance
Xsi:noNamespaceSchemaLocation
=“book.xsd”>
<book category=“Fiction”>
<title>Joy of Integration</title>
<author>Joe Smith</author>
</book>
<book category=“Non-Fiction”>
<title>Integration for
Dummies</title>
<author>John Doe</author>
</book>
</inventory>
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
2. Formatting the text to new
characteristics 2. Formatting the text to new
– Information is placed in a particular
type of text structure
characteristics
– E.g., XML, HTML, PDF, etc • Information is placed in a
particular type of text structure
– E.g., XML, HTML, PDF, etc
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
Using XSLT for B2B Application Integration
• XSLT provides standard approach to both rules and transformation
processing
• Preferred standard mechanism for transforming content and application
semantics as information moves from application to application and
business to business
• XSLT can also create text-based formats
SAP PDF
XSLT
XML XML
Custom
Application
HTML
Data
XML can establish a standard data transport format
within and between application tiers
7
02/05/2015
XML documents can be used as the standard data
transport throughout integrated environments
XSD schemas validating incoming data for
each application endpoint
8
02/05/2015
XSLT can perform dynamic structural
transformations
Presentation centric transformations can be
incorporated to output data for different mediums