1 / 26

XML

XML. Realizing Portable Data. Ryan Wilson February 12, 2003. XML Agenda. <?xml version=“1.0”?> <presentation> <agenda> <item> The Problem of Data </item> <item> What is XML? </item> <item> Extensions of XML </item> <item> Practical Applications </item> </agenda>

Download Presentation

XML

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 Realizing Portable Data Ryan Wilson February 12, 2003

  2. XML Agenda <?xml version=“1.0”?> <presentation> <agenda> <item>The Problem of Data</item> <item>What is XML?</item> <item>Extensions of XML</item> <item>Practical Applications</item> </agenda> </presentation>

  3. The Problem of Data • How do you store or send data in your application? • Document Storage • ex. Word, Excel, HTML, etc. • Configuration Files • Remote Procedure Calls

  4. The Problem of Data • Proprietary formats • Reinventing the wheel • Rewrite (and debug) parsers • Document format for others

  5. What is XML? • Extensible Markup Language • Derived from SGML • W3C Standard (1998) • A standard format for all types of computer documents • Human readable format • Always text, never binary data

  6. What is XML? • Data is strings of text and delimited by tags • XML doesn’t define the tags! • Makes it a meta-markup language • Flexibility • XML does define what the tags look like and how they can be organized

  7. What is XML? <?xml version=“1.0”?> <!-- class information data --> <classRoster course=“COT4810” section=“2”> <teacher>Dutton</teacher> <student>Wilson</student> <student>Doe</student> <testdate></testdate> <testdate/> </classRoster>

  8. Tags <?xml version=“1.0”?> <!-- class information data --> <classRoster course=“COT4810” section=“2”> <teacher>Dutton</teacher> <student>Wilson</student> <student>Doe</student> <testdate></testdate> <testdate/> </classRoster>

  9. Start Tags <?xml version=“1.0”?> <!-- class information data --> <classRoster course=“COT4810” section=“2”> <teacher>Dutton</teacher> <student>Wilson</student> <student>Doe</student> <testdate></testdate> <testdate/> </classRoster>

  10. End Tags <?xml version=“1.0”?> <!-- class information data --> <classRoster course=“COT4810” section=“2”> <teacher>Dutton</teacher> <student>Wilson</student> <student>Doe</student> <testdate></testdate> <testdate/> </classRoster>

  11. Attributes <?xml version=“1.0”?> <!-- class information data --> <classRoster course=“COT4810” section=“2”> <teacher>Dutton</teacher> <student>Wilson</student> <student>Doe</student> <testdate></testdate> <testdate/> </classRoster>

  12. Processing Instructions <?xml version=“1.0”?> <!-- class information data --> <classRoster course=“COT4810” section=“2”> <teacher>Dutton</teacher> <student>Wilson</student> <student>Doe</student> <testdate></testdate> <testdate/> </classRoster>

  13. Comments <?xml version=“1.0”?> <!-- class information data --> <classRoster course=“COT4810” section=“2”> <teacher>Dutton</teacher> <student>Wilson</student> <student>Doe</student> <testdate></testdate> <testdate/> </classRoster>

  14. What is XML? • You define the tags to use • XML Application • XML Application “Grammar” can be formally defined in: • DTD (Document Type Definition) • XML Schema

  15. What can XML do? • Document Storage • ex. Open Office • Books/Technical Documents • Remote Procedure Calls • Vector Graphics • Slices, Dices, and makes Julian Fries!

  16. What XML is Not • Programming Language • Doesn’t do anything • Network-Transport Protocol • “XML is a structural and semantic markup language, not a presentation language”(XML in a Nutshell p.4) • Not like HTML • Database • XML can be stored in a database • Database could save its data in XML

  17. XML – Portable Data • Simple • Well-documented • Human-readable • ex. NASA’s moon landings data

  18. Using XML • Lots of XML parsers available • Don’t have to write your own! • Standards for Parsers • DOM – Document Object Model • Creates XML Tree • Reads in whole document before processing • Read/Write • SAX • Processes XML as it is read • Read-only

  19. DOM – XML Tree <student> <name>Ryan Wilson</name> <major>Computer Science</major> </student> Root student name major Ryan Wilson Computer Science

  20. Extensions to XML • XSLT • Extensible Stylesheet LanguageTransformations • Convert an XML document into another document • ex. XML document into a web page

  21. <book title=“LoTR: The Two Towers”> <chapter title=“The Departure of Boromir”> Aragorn sped up the hill… </chapter> <chapter title=“The Riders of Rohan”> Dusk deepened. Mist lay behind them… </chapter> <chapter title=“The Uruk-Hai”> Pippin lay in a dark and troubled dream… </chapter> </book>

  22. <html> <head> <title>LoTR: The Two Towers</title> </head> <body> <h1>Table of Contents</h1> <ol> <li>The Departure of Boromir</li> <li>The Riders of Rohan</li> <li>The Uruk-Hai</li> </ol> </body> </html>

  23. Extensions to XML • Presentation XML • or “Making your XML Look Pretty” • CSSCascading Style Sheets • Already used for web pages • Describes how to display XML • XSL-FOXSL Formatting Objects • Use XSLT to turn into XSL-FO

  24. Practical Applicationsor “Why CS Students should care about XML” • Web publishing frameworks • www.gentoo.org • ex. Apache’s Cocoon • Configuration Files • ex. Gconf • Remote Procedure Calls (RPC) • XML-RPC • SOAP –Simple Object Access Protocol

  25. For More Information • www.xml.com • O’Reilly Books • XML in a Nutshell • Java and XML • xml.apache.org

  26. Questions?

More Related