|
XML PowerPoint
View PowerPoint
Presentation
XML as a Document Exchange Format
Tom Loukas
AMS Center for Advanced Technologies
September 26th, 2001
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
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
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
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>
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>
XML Document Definition - DTD
n Part of XML version 1.0
n Used to specify structure of an XML document
- Element names, element structure, attribute names, valid value
lists
n Can be embedded within the XML document or specified via a location
reference (e.g. a URL)
n 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) >
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
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>
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>
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>
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>
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)
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,
.
Sample Web Service invocation using
SOAP and HTTP
HTTP/1.1 200 OK.Content-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>
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
The Other Side of the Coin
- Parsing overhead
- Tag data and text format result in increased network utilization
XML Standards and Initiatives
- XML specification itself - W3C
- Industry-specific XML vocabularies
- FpML Financial Products Markup Language
- Vendor driven XML standards
- Open standards initiatives
- Government XML initiatives
Establishing XML standards for data exchange
- Document types
- Document structure and content
- Document processing flow and rules
Document processing flow and rules
| Organization A |
Transmit order
 |
Organization B |
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 |
Other processing considerations
- Transport protocols and security
- Error handling procedures
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
...
|