Title: XML as a Document Exchange Format
1XML as a Document Exchange Format
- Tom Loukas
- AMS Center for Advanced Technologies
- September 26th, 2001
2Why 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
3What 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
4Some 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
5Sample XML Document
- ltpurchaseOrder orderDate"1999-10-20"gt
- ltshipTo country"US"gt
- ltnamegtAlice Smithlt/namegt
- ltstreetgt123 Maple Streetlt/streetgt
- ltcitygtMill Valleylt/citygt
- ltstategtCAlt/stategt
- ltzipgt90952lt/zipgt
- lt/shipTogt
- ltitemsgt
- ltitem partNum"872-AA"gt
- ltproductNamegtLawnmowerlt/productNamegt
- ltquantitygt1lt/quantitygt
- ltpricegt148.95lt/pricegt
- lt/itemgt
-
Element tags Attributes Data
6Sample XML Document (continued)
- ltitem partNum"926-AA"gt
- ltproductNamegtBaby Monitorlt/productName
gt - ltquantitygt1lt/quantitygt
- ltpricegt39.98lt/pricegt
- ltshipDategt1999-05-21lt/shipDategt
- lt/itemgt
- lt/itemsgt
- lt/purchaseOrdergt
Element tags Attributes Data
7XML 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
8Sample XML DTD
- lt!DOCTYPE purchaseOrder
- lt!ELEMENT purchaseOrder (shipTo, Items) gt
- lt!ATTLIST purchaseOrder orderDate CDATA REQUIRED
gt - lt!ELEMENT shipTo (name, street, city, state, zip)
gt - lt!ATTLIST shipTo country CDATA REQUIRED gt
- lt!ELEMENT name (PCDATA) gt
- lt!ELEMENT street (PCDATA) gt
- lt!ELEMENT city (PCDATA) gt
- lt!ELEMENT state (PCDATA) gt
- lt!ELEMENT zip (PCDATA) gt
- lt!ELEMENT Items (item) gt
- lt!ELEMENT item (productName, quantity, USPrice) gt
- lt!ATTLIST item partNum CDATA REQUIRED gt
- lt!ELEMENT productname (PCDATA) gt
- lt!ELEMENT quantity (PCDATA) gt
- lt!ELEMENT USPrice (PCDATA) gt
-
9XML 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
10Sample XML Schema
- ltxsdschema xmlnsxsd"http//www.w3.org/2001/XMLS
chema"gt - ltxsdelement name"purchaseOrder"
type"PurchaseOrderType"/gt - ltxsdcomplexType name"PurchaseOrderType"gt
- ltxsdsequencegt
- ltxsdelement name"shipTo"
type"USAddress"/gt - ltxsdelement name"items"
type"Items"/gt - lt/xsdsequencegt
- ltxsdattribute name"orderDate"
type"xsddate"/gt - lt/xsdcomplexTypegt
-
11Sample XML Schema (continued)
- Definition of the USAddress complex type
- ltxsdcomplexType name"USAddress"gt
- ltxsdsequencegt
- ltxsdelement name"name"
type"xsdstring"/gt - ltxsdelement name"street"
type"xsdstring"/gt - ltxsdelement name"city"
type"xsdstring"/gt - ltxsdelement name"state"
type"xsdstring"/gt - ltxsdelement name"zip"
type"xsddecimal"/gt - lt/xsdsequence
- ltxsdattribute name"country"
type"xsdNMTOKEN fixed"US"/gt - lt/xsdcomplexTypegt
-
12Sample XML Schema (continued)
- Definition of the USAddress complex type
- ltxsdcomplexType name"Items"gt
- ltxsdsequencegt
- ltxsdelement name"item" minOccurs"0
- maxOccurs"unbounded"gt
- ltxsdcomplexTypegt
- ltxsdsequencegt
- ltxsdelement
name"productName" type"xsdstring"/gt - ltxsdelement
name"quantity"gt - ltxsdsimpleTypegt
- ltxsdrestriction
base"xsdpositiveInteger"gt - ltxsdmaxExclusive
value"100"/gt - lt/xsdrestrictiongt
- lt/xsdsimpleTypegt
- lt/xsdelementgt
13Sample XML Schema (continued)
- more child elements of the item
element .. - ltxsdelement name"USPrice"
type"xsddecimal"/gt - ltxsdelement name"shipDate"
type"xsddate" - minOccurs"0"/gt
- lt/xsdsequencegt
- ltxsdattribute name"partNum"
type"xsdstring use"required"/gt - lt/xsdcomplexType
- lt/xsdelementgt
- lt/xsdsequence
- lt/xsdcomplexTypegt
-
14Manipulating 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)
15Major 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, .
16Sample 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"ltSOAP-ENVEnvelope
xmlnsSOAP-ENV"http//schemas.xmlsoap.org/soap/en
velope/" SOAP-ENVencodingStyle"http//schema
s.xmlsoap.org/soap/encoding/"gt
ltSOAP-ENVBodygt ltmGetLastTradePrice
xmlnsm"Some-URI"gt
ltsymbolgtDISlt/symbolgt lt/mGetLastTradePric
egt lt/SOAP-ENVBodygt lt/SOAP-ENVEnvelopegt
17Sample Web Service response
HTTP/1.1 200 OKContent-Type text/xml
charset"utf-8"Content-Length
nnnnltSOAP-ENVEnvelope xmlnsSOAP-ENV"http/
/schemas.xmlsoap.org/soap/envelope/"
SOAP-ENVencodingStyle"http//schemas.xmlsoap.org
/soap/encoding/"/gt ltSOAP-ENVBodygt
ltmGetLastTradePriceResponse xmlnsm"Some-URI"gt
ltPricegt34.5lt/Pricegt
lt/mGetLastTradePriceResponsegt
lt/SOAP-ENVBodygtlt/SOAP-ENVEnvelopegt
18Benefits 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
19The Other Side of the Coin
- Parsing overhead
- Tag data and text format result in increased
network utilization
20XML 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
21Establishing XML standards for data exchange
- Document types
- Document structure and content
- Document processing flow and rules
22Document processing flow and rules
Transmit order
Organization A
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
23Other processing considerations
- Transport protocols and security
- Error handling procedures
24Standards 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 ...
25Thank you