1 / 22

XML

What XML is and what it means to me as a Computer Scientist. By: Derek Edwards CS 376 March 10, 2003. XML. Overview. What is XML XML & HTML What does XML do Uses of XML XML & HTML Example XML Syntax Displaying XML Data Binding. XML stands for:. X tensible M arkup L anguage.

cmeza
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. What XML is and what it means to me as a Computer Scientist By: Derek Edwards CS 376 March 10, 2003 XML

  2. Overview • What is XML • XML & HTML • What does XML do • Uses of XML • XML & HTML Example • XML Syntax • Displaying XML • Data Binding

  3. XML stands for: Xtensible Markup Language What is XML?

  4. What is XML? • Very similar to HTML • Designed to describe data • No predefined tags like in HTML • Uses a Document Type Definition (DTD) or an XML Schema to describe data

  5. XML & HTML • XML describes data • HTML displays data

  6. What does XML do? • Nothing. • XML is just a structure that stores data

  7. Uses of XML • Shares Data • Data is stored in a plain text format. • Lets different applications access the same information

  8. Uses of XML • Stores data • Used widely in database systems and file systems to store data • Applications can then be written to retrieve the stored data • Another application can then display the text in a certain way

  9. Uses of XML • Creates new languages • WML (wireless markup language) is written in XML

  10. Simple HTML file <html> <head> <title>note</title> </head> <body> <p>To: John <p>From: Frank <p>Subject: Reminder <p>Message: Don’t forget the money you owe me </body> </html> Click here for online file

  11. Same file in XML <?xml version=“1.0” encoding=“ISO-8859-1”?> <note> <to>John</to> <from>Frank</from> <subject>Reminder</subject> <msg>Don’t forget the money you owe me </msg> </note> Click here for online file

  12. XML File Line by Line <?xml version=“1.0” encoding=“ISO-8859-1”?> <note> <to>John</to> <from>Frank</from> <subject>Reminder</subject> <msg>Don’t forget the money you owe me </msg> </note> _______________________________________________ • XML declaration line, defines version and the character type • Same as: <html> · · · · · </html>

  13. XML File Line by Line <?xml version=“1.0” encoding=“ISO-8859-1”?> <note> <to>John</to> <from>Frank</from> <subject>Reminder</subject> <msg>Don’t forget the money you owe me </msg> </note> _______________________________________________ • Describes the root element in the file • “This document is a note” • Same as: <body> · · · · · </body>

  14. XML File Line by Line <?xml version=“1.0” encoding=“ISO-8859-1”?> <note> <to>John</to> <from>Frank</from> <subject>Reminder</subject> <msg>Don’t forget the money you owe me </msg> </note> _______________________________________________ • The child elements in the file • Same as: <p> · · · · · </p>

  15. XML Syntax • All XML tags must have opening and closing tags • All tags are case sensitive HTML <p>This is paragraph 1… <P>This is paragraph 2... XML <p>This is paragraph 1...</p> <P>This is paragraph 2...</P>

  16. XML Syntax • All XML tags must be nested properly HTML <b><I>This is bold & italic</b></I> XML <b><I>This is bold & italic</I></b>

  17. XML Syntax • Only one root element allowed <note> <to>John</to> <from>Frank</from> <subject>Reminder</subject> <msg>Don’t forget the money you owe me </msg> </note> <note> · · </note>

  18. Another XML Example <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> Click for cd.xml

  19. Displaying XML • Can be displayed using a Cascading Stylesheet • Preferred method is to use Extensible Stylesheet Language (XSL) Click for online CSS file Click for CD database with CSS file

  20. Data Binding in XML • “Data Islands” can be bound to HTML elements (like HTML Tables) <html> <body> <xml id="cdcat" src="cd.xml"></xml> <table border="1" datasrc="#cdcat"><tr> <td><span datafld="ARTIST"></span></td> <td><span datafld="TITLE"></span></td> </tr> </table> </body> </html> Click for online version

  21. Displaying XML Again • Endless ways to display XML • CD Database Example using <THEAD> and <TFOOT> tags • Another rendering of the CD Database • CD Database using form elements and JavaScript • Simple application for the CD Database Using <THEAD> and <TFOOT> Full Rendering in Table Using Form Buttons Simple Application

  22. XML • Very versatile • Code is completely customizable • Display is completely customizable • Becoming widely used • Becoming more and more important • Must have at least an understanding about it

More Related