An Introduction To XML 1Fall 2006 OCT Lecture 1“An Introduction to XML” or “Why I still findcomputers exciting”Michael McCarthyAssociate Teaching ProfessorCarnegie Mellon UniversityAn Introduction To XML 2XML On The World Wide Web• What is XML?• What is XML’s Primary purpose?• XML in 10 points (from the W3C)• Example Documents• PredictionsAn Introduction To XML 3What is XML? XML is an acronym that stands for the eXtensible Markup Language. It is a flexible framework which can be used to create new customized markup languages. HTML, for example, is a markup language with a fixed tag set. <P> <H1> ….XML, on the other hand, does not define any particular set of tags. It allows you to create your own tag set.An Introduction To XML 4What is XML’s primary purpose? Separating data from presentation The range of internet capable devices is growing- WAP phones, pagers, TV sets, web browsers, in car computers, have different presentation requirements. Transmitting data between applications XML allows systems to interoperate.An Introduction To XML 5XML in 10 PointsXML is for structuring dataXML looks a bit like HTMLXML is text, but it isn’t meant to be readXML is verbose by designXML is a family of technologies (Xlink, Xpointer, CSS, XSLT, DOM, SAX…)XML is new, but not that newAn Introduction To XML 6XML in 10 PointsXML leads HTML to XHTMLXML is modularXML is the basis for RDF and the SemanticWebXML is license-free, platform-independentand well-supportedAn Introduction To XMLAn Introduction To XML77Example XML DocumentsAn Introduction To XML 8<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE FixedFloatSwap SYSTEM "FixedFloatSwap.dtd"><FixedFloatSwap> <Notional currency=“pounds”>100</Notional> <Fixed_Rate>5</Fixed_Rate> <NumYears>3</NumYears> <NumPayments>6</NumPayments></FixedFloatSwap>An Interest Rate Swap in XMLAn Introduction To XML 9A DTD for Interest Rate Swap<?xml version="1.0" encoding="utf-8"?><!ELEMENT FixedFloatSwap ( Notional, Fixed_Rate, NumYears, NumPayments ) ><!ELEMENT Notional (#PCDATA)><!ATTLIST Notional currency (dollars | pounds) #REQUIRED><!ELEMENT Fixed_Rate (#PCDATA) ><!ELEMENT NumYears (#PCDATA) ><!ELEMENT NumPayments (#PCDATA) >An Introduction To XML 10Document Type Definitions•DTD’s are used to define a class of document•DTD’s specify a grammar•Valid documents conform to the grammar specified in the DTD.•Automatic validation is provided by parsers from Sun, Microsoft, IBM, Oracle and others.•An application programmer can program against these documents by referring to their DTDs.• XSDL (XML Schema Definition Language) is an improvement11documentXML docdoctypeFixedFloatSwapNotionalFixedRateNumYears NumPayments100 5 36The document as seen by the DOM programmerAn Introduction To XMLAn Introduction To XML1212Real World XML LanguagesMATHML (1998)• The first specialized XML Vocabulary1313MathMLWorking Group Members at W3C:• Wolfram Research (Mathematica 3.0)• Waterloo Maple (Maple V7.0)14MathML Example< m ath> < apply>< int/>< bvar>< ci> x< /ci>< /b var>< low lim it>< ci>a< /ci>< /low lim it>< uplim it>< ci>b< /ci>< /uplim it>< apply>< citype= "fn"> f< /ci>< ci> x< /ci>< /apply>< /apply>< /m ath> An Introduction To XMLAn Introduction To XML1515Chemical Markup Language(CML)Tackling the problems associatedwith the exchange of chemicalinformation since 1995An Introduction To XML 16A CML Example Document<cml><molecule><bibliography><person><string title="lastname">PROUT</string><string title="initials">C.K</string></person><person><string title="lastname">ARMSTRONG</string><string title="initials">R.A</string></person><person>Crystal.xml fromCML’s web siteAn Introduction To XML 17<string title="lastname">CARRUTHERS</string><string title="initials">J.R</string></person><person><string title="lastname">FORREST</string><string title="initials">J.G</string></person><person><string title="lastname">MURRAY-RUST</string><string title="initials">P</string></person><string builtin="JOUR">J.CHEM.SOC.A</string></bibliography>An Introduction To XML 18<molecule class="2d"><formula><string title="stoichiometry"> C16 H18 CU1 O8</string></formula><atomArray><stringArray builtin="elementType">CU O O O O O O C C C C C C C C C C O O C C C C C C</stringArray><stringArray builtin="atomId">a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25Long Document TruncatedAn Introduction To XMLAn Introduction To XML1919The Financial Product Markup Language(FpML)Enables e-commerce activities inthe field of financial derivatives.An Introduction To XML 20An FpML Example Document<?xml version ="1.0"?><!DOCTYPE FpML PUBLIC "-//FpML//DTD Financial product Markup Language 1-0//EN" "fpml-dtd-1-0-2001-05-14.dtd" ><FpML version = "1-0" businessCenterSchemeDefault = "http://www.fpml.org/spec/2000/business-center-1-0" businessDayConventionSchemeDefault = "http://www.fpml.org/spec/2000/business-day-convention-1-0"An Introduction To XML 21<trade> <tradeHeader> <partyTradeIdentifier> <partyReference href = "#CHASE" /> <tradeId
View Full Document