DOC PREVIEW
UH COSC 6340 - XML History

This preview shows page 1-2 out of 7 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1XMLOn the Preservation of MemoriesTo maintain the condition of their memories, the famasproceed in the following manner: after having fastened thememory with webs and reminders, with every possibleprecaution, they wrap it from head to foot in a black sheet andstand it against the parlor wall with a little label which reads:"EXCURSION TO QUILMES" or "FRANK SINATRA".Cronopios, on the other hand, disordered and tepid beings thatthey are, leave memories loose about the house. They set themdown with happy shouts and walk carelessly among them, andwhen one passes through running they caress it mildly and tellit "Don’t hurt yourself," and also "Be careful of the stairs." It isfor this reason that the famas’ houses are orderly and silent,while in those of the cronopios there is great uproar and doorsslamming. Neighbors always complain about cronopios, andthe famas shake their heads understandingly, and go and see ifthe tags are all in place.Julio Cortázar, Cronopios and Famas, 1962.XML History• XML was invented as a way to tag documents in anextensible way– E.g. Shakespeare’s plays could be tagged by speaker<Juliet>O Romeo, Romeo! wherefore art thou Romeo?</Juliet>– Goal vs. HTML: separate content from presentation• XSL is a companion language to specify screen presentation• Note that tags in HTML mix up these issues!• XML is used much more widely for messages• E.g. Ford’s purchasing app generates a purchase order in XMLformat, e-mails it to a billing app at Firestone• Firestone’s billing app ingests the email, generates a bill in XMLformat, and e-mails it to Ford’s bank– A simplified picture, but XML for business messages is common– I.e. XML is a “wire format” for inter-program communication• XML is a way to represent data – compare to Relational? ToObject-Relational?2XML by example<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE Contract SYSTEM "http://xml.cXML.org/schemas/cXML/1.1.010/cXML.dtd"><Contract><SupplierID>123456</SupplierID><Comments>Sample cXML contract</Comments><ItemSegment><ContractItem><ItemID><SupplierPartID>12345</SupplierPartID></ItemID><UnitPrice><Money>1.50</Money></UnitPrice><Extrinsic> http://www.workchairs.com/CoolProducts </Extrinsic></ContractItem><ContractItem><ItemID><SupplierPartID>12347</SupplierPartID></ItemID><UnitPrice><Money>111.50</Money></UnitPrice></ContractItem></ItemSegment></Contract>ïPreamble!includes!XML!declaration,!rootelement,!ref!to!ìDTDîïSo!far,!looks!like!object-relational!withnesting.ïNote!that!order!matters!(i.e.!no!sets,!onlylists)Tags with Attributes<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE Contract SYSTEM "http://xml.cXML.org/schemas/cXML/1.1.010/cXML.dtd"><Contract effectiveDate="1999-01-01T14:32:20-08:00"expirationDate="2000-06-01T12:00:00-08:00"><SupplierID domain="DUNS">123456</SupplierID><Comments xml:lang="en-US">Sample cXML contract</Comments><ItemSegment segmentKey="Detroit"><ContractItem><ItemID><SupplierPartID>12345</SupplierPartID></ItemID><UnitPrice><Money currency="USD">1.50</Money></UnitPrice><Extrinsic name="URL"> http://www.workchairs.com/CoolProducts </Extrinsic></ContractItem><ContractItem><ItemID><SupplierPartID>12347</SupplierPartID></ItemID><UnitPrice><Money currency="USD">111.50</Money></UnitPrice></ContractItem></ItemSegment></Contract>ïNot!clear!why!this!was!deemedimportant.ïNote!that!attributes!cannot!be!sets,but!nested!tags!can3Document Type Declarations (DTDs)<?xml version="1.0" encoding="UTF-8"?><!ENTITY % datetime.tz "CDATA"><!ENTITY % string "CDATA"><!ENTITY % nmtoken "CDATA"> <!-- Any combination of XML name chars. --><!ENTITY % xmlLangCode "%nmtoken;"> <!-- Language code as defined by XMLrecommendation: Language andcountry. --><!ELEMENT SupplierID (#PCDATA)><!ATTLIST SupplierIDdomain %string; #REQUIRED><!ELEMENT Comments ( #PCDATA | Attachment )* ><!ATTLIST Commentsxml:lang %xmlLangCode; #IMPLIED><!ELEMENT ItemSegment (ContractItem+)><!ATTLIST ItemSegmentsegmentKey %string; #IMPLIED><!ELEMENT Contract (SupplierID+, Comments?, ItemSegment+)><!ATTLIST ContracteffectiveDate %datetime.tz; #REQUIREDexpirationDate %datetime.tz; #REQUIRED>Hereís!a!DTD!for!our!ContractNote:!can!be!missing!somefields,!can!have!>1!of!others.Without!a!DTD,!can!have!allkinds!of!tags!!!Some!claim!thisas!a!benefit!of!XML.Other miscellaneous features• XML docs can have IDs and IDREFs, URIs– reference to another document or document element• Document Object Model (DOM)– A tree “object” API for traversing an XML or HTML doc–Typically for Java• XML Schema is a proposal to replace/augment DTDs– Has a notion of types and typechecking– May introduce some notions of IC’s– Quite complicated, controversial ... not really adopted yet• XML Namespaces– Can import tag names from others– Disambiguate by prefixing the namespace name• I.e. berkeley-eecs:gpa is different from uphoenix:gpa• Lots of other details, tools, etc.4Advantages of XML vs. Relational• ASCII makes things easy–Easy to parse– Easy to ship (e.g. across firewall, via email, etc.)• Self-documenting– Metadata (tag names) come wit the data• Nested– Can bundle lots of related data into one message– (Note: object-relational allows this)• Can be sloppy–don’t have to define a schema in advance• Standard– The most interesting thing about XML is that people areinterested in it!– Lots of free Java tools for parsing and munging XML• Expect lots of Microsoft tools (C#) for sameWhat XML does not solve• XML doesn’t standardize metadata– It only standardizes the metadata language• Not that much better than agreeing on an alphabet– E.g. my <price> tag vs. your <price> tag• Mine includes shipping and federal tax, and is in $US• Yours is manufacturer’s list price in ¥Japan– XML Schema is a proposal to help with some of this• XML doesn’t help with data modeling– No notions of IC’s, FD’s, etc.–In fact, encourages non-first-normal form!• You will probably have to translate to/from XML– Relational vendors will help with this ASAP– XML “features” (nesting, ordering, etc.) make this a pain– Flatten the XML if you want data independence (?)5What about XML queries?• Xpath– A single-document language for “path expressions”• Not unlike regular expressions on tags• E.g. /Contract/*/UnitPrice, /Contract//UnitPrice, etc.• XSLT– XPath plus a language for formatting output• XML-Query (a.k.a. XQuery)– An SQL-like proposal with extra


View Full Document
Download XML History
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view XML History and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view XML History 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?