Title: Grenoble Ecole de Management MEDFORIST Workshop XML in Brief
1Grenoble Ecole de ManagementMEDFORIST
WorkshopXML in Brief
- Asuman Dogac
- Middle East Technical University
- Ankara Turkey
- asuman_at_srdc.metu.edu.tr
2XML
- Extensible Markup Language has become the
universal standard for representing data - XML started out as a standard data exchange
format for the Web - Yet, it has quickly become the fundamental
instrument in the development of Web-based online
information services and electronic commerce
applications - Almost all recent electronic commerce standards
are based on XML
3XML
- A subset of SGML (Standard Generalized Markup
Language) it is defined by World Wide Web
Consortium - HTML enables a universal method of displaying
data XML provides a universal method of
describing data - Provides the ability to describe data in an open
text-based format and deliver it using standard
http protocol
4XML
- At present, many applications on the Web use XML
for hosting large amounts of structured and
semi-structured data - Representation of information in XML documents
has been increasing at an astonishing pace - According to Meta Group, by 2003, about 65 of
corporate data will be stored in an XML format
5XML The Unifying Technology
XML Messaging
Internet
6Maturity of Web Infrastructure
Technology
Standard
Innovation
Browse the Web
Program the Web
7XML helps address the challenge
- The data is self-describing
- e.g. the meaning of the data is included
identifiers surround every bit of data,
indicating what it means - Far more flexible method of representing
transmitted information - e.g. batched orders sent together can have
different fields and format without breaking apps
on each end - Open, standard technologies for moving,
processing and validating the data - e.g. the XML parser can automatically parse,
validate, and feed the information to an
application, instead of every application having
to include this functionality
8XML An Example
Data stream in a typical interface
Electronic Commerce, 100, Turban, 25,
Addison-Wesley
Same data stream in XML
ltBOOKgt ltTITLEgt Electronic Commerce
lt/TITLEgt ltQUANTITYgt 100 lt/QUANTITYgt ltAUTHORgtTurb
anlt/AUTHORgt ltPRICEgt25lt/PRICEgt ltPUBLISHERgtAddison
-Wesleylt/PUBLISHERgt lt/BOOKgt
9Mark up (or Tagging)
- XML uses textual markups to define data
- An XML document is comprised of a collection of
tagged elements each containing a start tag
(lttagnamegt), an end tag (lt/tagnamegt), and the
content between the two tags - Example
- ltPONumbergt 1234ABCD lt/PONumbergt
10Tagging Data in XML
- ltPONumbergt 1234ABCD lt/PONumbergt
- Considering the content only, it is not possible
to understand what 1234ABCD stands for - The tag name PONumber intuitively tells that the
content is a purchase order number - Similarly, an XML element might be tagged as
name, gender, birth date, salary, price, - XML is extensible in the sense that users can
create their own vocabularies, the tag names are
neither predefined nor limited
11Adding Structure to data
- Tagged elements may be nested to any depth to
provide structured data, or may be repeated to
represent a list of values - A valid XML document usually contains a single
root element, which constitutes the top-level of
nesting - In other words, a valid XML document represents a
tree of elements
12Giving Meaning and Structure to Data
Start Tag
Start Tag
- ltPurchaseOrderRequestgt
- ltPONumbergt1234ABCD lt/PONumbergt
- ltPurchaseOrderDategt20030601lt/PurchaseOrderDategt
- ltLineItemgt
- ltItemEAN_Identification no9344 /gt
- ltQuantityOrderedgt 16 lt/QuantityOrderedgt
- ltUnitPricegt 95 ltUnitPricegt
- lt/LineItemgt
- ltLineItemgt lt/LineItemgt
- lt/PurchaseOrderRequestgt
An Element
Another Element
An Attribute
Data
End Tag
13Giving Structure to Data
PurchaseOrderRequest
PurchaseOrderDate
LineItem
PONumber
ItemEAN_Identification
QuantityOrdered
UnitPrice
14Document Type Definition (DTD)
- The principle purpose of the DTD is to declare
the hierarchy of document elements - A document type definition defines
- The name of the elements,
- The content model of each element,
- How often and in which order elements may appear,
- If the end-tags can be shortcut,
- The possible presence of attributes and their
default values, - The names of the entities
15An Example DTD
- lt?xml version1.0 encodingUTF-8?gt
- lt!DOCTYPE simple
- lt!ELEMENT PurchaseOrderRequest (PONumber,
PurchaseOrderDate, LineItem)gt - lt!ELEMENT LineItem (ItemEAN_Identification,
QuantityOrdered, UnitPrice)gt - lt!ELEMENT ItemEAN_Identification(PCDATA)gt
- lt!ELEMENT QuantityOrdered (PCDATA)gt
- lt!ELEMENT UnitPrice (PCDATA)gt
- lt! --This is a comment line to state that the
other elements are skipped --gt ...gt
16DTDs
- A DTD specifies the structure of an XML element
by specifying the names of its sub-elements and
attributes - Sub-element structure is specified using the
operators - set with zero or more elements
- set with one or more elements
- ? optional
- or
- All values are assumed to be string values,
unless the type is ANY in which case the value
can be an arbitrary XML fragment
17XML Namespaces
- Namespaces are a simple and straightforward way
to distinguish names used in XML documents, no
matter where they come from - The only reason namespaces exist, is to give
elements and attributes programmer-friendly names
that will be unique across the whole Internet
18Example
- lthhtml xmlnsxdc"http//www.xml.com/books"
- xmlnsh"http//www.w3.org/HTML/1998/html4"gt
- lthheadgtlthtitlegtBook Reviewlt/htitlegtlt/hheadgt
- lthbodygt ltxdcbookreviewgt ltxdctitlegtXML A
Primerlt/xdctitlegt - lthtablegt lthtr align"center"gt
- lthtdgtAuthorlt/htdgtlthtdgtPricelt/htdgt
- lthtdgtPageslt/htdgtlthtdgtDatelt/htdgtlt/htrgt
- lthtr align"left"gt
- lthtdgtltxdcauthorgtSimon St. Laurentlt/xdcauthorgtlt/
htdgt - lthtdgtltxdcpricegt31.98lt/xdcpricegtlt/htdgt
- lthtdgtltxdcpagesgt352lt/xdcpagesgtlt/htdgt
- lthtdgtltxdcdategt1998/01lt/xdcdategtlt/htdgt
- lt/htrgt lt/htablegt lt/xdcbookreviewgt lt/hbodygt
lt/hhtmlgt
19XML Namespaces
- The prefixes are linked to the full names using
the attributes on the top element.whose names
begin xmlns. - The prefixes are just shorthand placeholders for
the full names - Those full names are URLs, i.e. Web addresses
20Extensibility in XML
- Anyone can invent new tags and attach a meaning
to those tags - But if every user creates its own XML definition
for describing his data, it is not possible to
achieve interoperability - For example, one may prefer to use the tag name
POR, while another prefers using the tag name
PurchaseOrderReq - In other words, a tagged document is not very
useful without some kind of agreement on the tags
among inter-operating applications
21Many Efforts for Standardized Tags
- HL7 for healthcare
- RosettaNet for supply chain integration in
Information Technology and Electronic Components
domain - ebXML for eBusiness
- Common Business Library (CBL) for electronic
catalogs, purchase orders, etc.
22XML Parsers
- A parser takes an XML document and makes its
structure and content available to an application
through an API - There are two main Application Programming
Interfaces (APIs) for writing parsers - Document Object Model (DOM) and
- Simple API for XML (SAX)
- Today, many parsers are both DOM and SAX compliant
23XML DOM Parser
A parser validates and makes the data contained
in an XML document available to the application
24XSLT Processor
- Converts an XML document to another form
- An XSL style sheet is a set of transformation
instructions for converting a source XML document
to a target document
25(No Transcript)
26Why XML?
27XML vs EDI
28XML vs EDI
29XML vs EDI