Understanding XML: History, Functionality, and Use Cases
E N D
Presentation Transcript
XML Lauren Pisciotta Zackary Zweber
History • Extensive Markup Language was developed in 1996 by an 11 member group with James Clark as the leader • Interestingly this group never met face to face, but rather communicated by email and teleconferencing • The technology is based off SGML from the 80’s • The designers simply took the best parts of SGML and merged it with the ease of use of HTML
Functional Paradigm • XML is a meta-language - a language for defining languages • In general, FP languages excel at language definition and implementation • Using OO design for XML tends merely to make our lives more difficult and our programs less clear
Comparable to HTML • Makes use of tags, words are between <brackets> • XML uses the tags only to delimit pieces of data, and leaves the interpretation of the data completely to the application that reads it • If you see a <p> in XML it doesn’t mean it’s a new paragraph, it could be anything
XML and Java • Functions are to FP what objects are to OOP • Both are platform independent • Both use data structures
Data Structuring • XML is a set of rules for designing text formats that let you structure your data • XML is NOT a programming language, and you don't have to be a programmer to use it or learn it • XML makes it easy for a computer to generate data, read data, and ensure that the data structure is unambiguous • XML avoids common pitfalls in language design: it is extensible, platform-independent, and it supports internationalization and localization
XML as text • An advantage to storing XML as text allows it to be opened in any text editor rather than just the original program • The rules of XML are more strict than HTML. A forgotten “>” in XML would cause errors allowed in HTML • The specifications in XML don’t allow applications to “second guess” what the programmer was trying to do
Bigger by design • Since XML is a text format and it uses tags to delimit the data, XML files are nearly always larger than comparable binary formats • Although binary would save space, with modern technology it isn’t necessary to make files tiny
The XML Family XML 1.0 – defines tags and attributes XLink – adds hyperlinks XPointer – pointing in XML documents(similar to a URL except points parts in the document) CSS – Style sheet language, used in HTML also XSL – Used for advanced style sheets DOM – set of function calls to manipulate XML files XML Schemas 1&2 – define XML-structure format
Modularity • XML allows you to define a new document format by combining and reusing other formats • XML provides a namespace mechanism to eliminate confusion when combining formats
XML Syntax • Case sensitive • Everything must have a close </> <p>New paragraph (illegal in XML) <p>New paragraph </p> (legal) • Proper nesting needed <b><i>Hello World</b></i> (illegal) • White space is not truncated • <!– This is a comment -->
Other things • XML is license free, so you don’t have to pay anybody to use it • It is platform independent, so you can create it with a variety of programs • Finally, it’s well supported, so when if you run into trouble there are lots of places to turn for help • Choosing XML is comparable to choosing SQL for a database
Hello World <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="HelloWorld.xsl" ?> <!-- Hello World in XML --> <text><string>Hello, World</string></text>
Real World Examples • http://www.bondmovies.com/board/markers.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <markers> <marker lng="-76.80784463882446" lat="42.08592980608292" title="thuffner" text="Where I live." type="yellow" /> <marker lng="4.49615478515625" lat="50.86144411058923" title="StonyArc" text="StonyArc DEV House" type="red" /> <marker lng="-117.96707153320312" lat="33.58716733904656" title="Perminisconious" text="My house is not underwater" type="yellow" /> <marker lng="-89.03785407543182" lat="42.20704003634335" title="JohnConner" text="Heres where I some what live" type="red" /> <marker lng="-118.44121634960175" lat="34.06879158520567" title="Shindig" text="At least, near here. ^.^" type="red" /> <marker lng="-95.32699584960937" lat="29.757224408272662" title="goldfinger1356" text="Goldfinger1356" type="red" /> <marker lng="-73.64417374134064" lat="45.59338068769037" title="Rob" text="The place where it all started" type="red" /> <marker lng="-73.49344432353973" lat="40.80126266614006" title="zmost22" text="Come Visit Me" type="red" /> <marker lng="-88.05485129356384" lat="41.69379273847097" title="Agent0007" text="Idlewood Dr" type="red" /> <marker lng="-82.01654434204101" lat="39.953438023308465" title="Jack Wade" text="Jack Wade" type="red" /> </markers>
QuickStart XML Tutorial • http://www59.homepage.villanova.edu/zackary.zweber/xml.htm