Upload
imogen-morrison
View
217
Download
2
Embed Size (px)
Citation preview
1AMS confidential & proprietary
International Business and Technology Consultants
XML as a Document Exchange Format
Tom Loukas
AMS Center for Advanced Technologies
September 26th, 2001
2AMS confidential & proprietary
Why XML?
To exchange data you must speak a common language
XML is well on its way to becoming that language
— Flexible self-describing language— Worldwide sanctioning bodies— Supported by most major software vendors— Already adopted by many industries
3AMS confidential & proprietary
What is XML?
Extensible Markup Language Structured language using tags to
describe data elements with a document Designed to facilitate data exchange
over the internet Version 1.0 of spec released in 1998 by
World Wide Web Consortium (W3C) Many additions to spec since then
4AMS confidential & proprietary
Some Design Goals for XML
Straightforward use over the Internet Support a wide variety of applications Ease of programmatic processing XML documents should be human-legible
and reasonably clear XML documents shall be easy to create
5AMS confidential & proprietary
Sample XML Document
<purchaseOrder orderDate="1999-10-20">
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo>
<items>
<item partNum="872-AA">
<productName>Lawnmower</productName>
<quantity>1</quantity>
<price>148.95</price>
</item>
Element tags
Attributes
Data
6AMS confidential & proprietary
Sample XML Document (continued)
<item partNum="926-AA">
<productName>Baby Monitor</productName>
<quantity>1</quantity>
<price>39.98</price>
<shipDate>1999-05-21</shipDate>
</item>
</items>
</purchaseOrder>
Element tags
Attributes
Data
7AMS confidential & proprietary
XML Document Definition - DTD
Part of XML version 1.0 Used to specify structure of an XML
document— Element names, element structure, attribute
names, valid value lists
Can be embedded within the XML document or specified via a location reference (e.g. a URL)
Uses non-XML syntax and lacks ability to specify data types
Sample XML DTD
<!DOCTYPE purchaseOrder [
<!ELEMENT purchaseOrder (shipTo, Items) >
<!ATTLIST purchaseOrder orderDate CDATA #REQUIRED >
<!ELEMENT shipTo (name, street, city, state, zip) >
<!ATTLIST shipTo country CDATA #REQUIRED >
<!ELEMENT name (#PCDATA) >
<!ELEMENT street (#PCDATA) >
<!ELEMENT city (#PCDATA) >
<!ELEMENT state (#PCDATA) >
<!ELEMENT zip (#PCDATA) >
<!ELEMENT Items (item+) >
<!ELEMENT item (productName, quantity, USPrice) >
<!ATTLIST item partNum CDATA #REQUIRED >
<!ELEMENT productname (#PCDATA) >
<!ELEMENT quantity (#PCDATA) >
<!ELEMENT USPrice (#PCDATA) >
9AMS confidential & proprietary
XML Document Definition - Schema
Created to address failings of original DTD specification
Support for data typing Enables more rigorous validation Uses XML syntax Finally became part of official spec in
May 2001
10AMS confidential & proprietary
Sample XML Schema
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:element name="shipTo" type="USAddress"/>
<xsd:element name="items" type="Items"/>
</xsd:sequence>
<xsd:attribute name="orderDate" type="xsd:date"/>
</xsd:complexType>
11AMS confidential & proprietary
Sample XML Schema (continued)
Definition of the USAddress complex type
<xsd:complexType name="USAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="zip" type="xsd:decimal"/>
</xsd:sequence
<xsd:attribute name="country" type="xsd:NMTOKEN” fixed="US"/>
</xsd:complexType>
12AMS confidential & proprietary
Sample XML Schema (continued)
Definition of the USAddress complex type
<xsd:complexType name="Items">
<xsd:sequence>
<xsd:element name="item" minOccurs="0”
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="productName" type="xsd:string"/>
<xsd:element name="quantity">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
13AMS confidential & proprietary
Sample XML Schema (continued)
…more child elements of the “item” element …..
<xsd:element name="USPrice" type="xsd:decimal"/>
<xsd:element name="shipDate" type="xsd:date"
minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="partNum" type="xsd:string” use="required"/>
</xsd:complexType
</xsd:element>
</xsd:sequence
</xsd:complexType>
14AMS confidential & proprietary
Manipulating XML Documents
Parsing— DOM (Document Object Model) Parsers— SAX (Simple API for XML) Parsers
Translating— XSLT processors— XML Mapping tools — Custom code
Editing— Text editors— Third party tools (e.g. XML Spy)
Storage and retrieval— Store as large text or binary object in an RDBMS— Map XML elements to columns of relational tables— Use specialized XML data store (e.g eXelon)
15AMS confidential & proprietary
Major Uses of XML
Data and document exchanges (A2A, B2B, G2B, G2G)
As a metadata format XLANG for process definitions (Microsoft) XMI for metadata exchange
Separating content from presentation Emerging Web Services Paradigm
— Business functions accessible over the web via widely used protocols
— Developing Standards – SOAP: Invoking web services
– WSDL: Describing web services
– Others: UDDI, WSFL, ….
16AMS confidential & proprietary
Sample Web Service invocation using SOAP and HTTP
POST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: "Some-URI"
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI"> <symbol>DIS</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
17AMS confidential & proprietary
Sample Web Service response
HTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8"Content-Length: nnnn
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>
18AMS confidential & proprietary
Benefits of XML
Industry support IBM, Microsoft, Oracle, ….. Ariba, Commerceone, webMethods, ... SAP, Baan, Siebel, Peoplesoft, AMS, ….
Human readable Self describing New elements can be added readily
19AMS confidential & proprietary
The Other Side of the Coin
Parsing overhead Tag data and text format result in
increased network utilization
20AMS confidential & proprietary
XML Standards and Initiatives
XML specification itself - W3C Industry-specific XML vocabularies
FpML Financial Products Markup Language
Vendor driven XML standards cXML and xCBL
Open standards initiatives ebXML
Government XML initiatives xml.gov
21AMS confidential & proprietary
Establishing XML standards for data exchange
Document types Document structure and content Document processing flow and rules
22AMS confidential & proprietary
Document processing flow and rules
Organization A Organization B
Transmit order
Acknowledge receipt of order
Provide estimated ship date
Acknowledge receipt of ship date info
Indicate order shipped
Acknowledge receipt of shipping confirmation
Payment notification
Acknowledge payment notification
23AMS confidential & proprietary
Other processing considerations
Transport protocols and security Error handling procedures
24AMS confidential & proprietary
Standards Administration
Some things to consider: Who will participate in developing and
maintaining the standards? Where will the standard specifications
reside? (schemas, process definitions, etc)
What process will be used for approval consensus?
How will change requests be administered?
Others …...
25AMS confidential & proprietary
Thank you