1 / 25

XML as a Document Exchange Format

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

lavada
Download Presentation

XML as a Document Exchange Format

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML as a Document Exchange Format Tom Loukas AMS Center for Advanced Technologies September 26th, 2001

  2. 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

  3. 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

  4. 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

  5. Sample XML Document Element tags Attributes Data <purchaseOrderorderDate="1999-10-20"> <shipTocountry="US"> <name>Alice Smith</name> <street>123 Maple Street</street> <city>Mill Valley</city> <state>CA</state> <zip>90952</zip> </shipTo> <items> <itempartNum="872-AA"> <productName>Lawnmower</productName> <quantity>1</quantity> <price>148.95</price> </item>

  6. Sample XML Document (continued) Element tags Attributes Data <itempartNum="926-AA"> <productName>Baby Monitor</productName> <quantity>1</quantity> <price>39.98</price> <shipDate>1999-05-21</shipDate> </item> </items> </purchaseOrder>

  7. 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

  8. 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) >

  9. 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

  10. 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>

  11. 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>

  12. 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>

  13. 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>

  14. 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)

  15. 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, ….

  16. 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>

  17. 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>

  18. 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

  19. The Other Side of the Coin • Parsing overhead • Tag data and text format result in increased network utilization

  20. 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

  21. Establishing XML standards for data exchange • Document types • Document structure and content • Document processing flow and rules

  22. Document 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

  23. Other processing considerations • Transport protocols and security • Error handling procedures

  24. 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 …...

  25. Thank you

More Related