Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML CS 105. What is XML? XML stands for Extensible Markup Language. XML is a markup language like HTML. XML was designed to describe data. You must define.

Similar presentations


Presentation on theme: "XML CS 105. What is XML? XML stands for Extensible Markup Language. XML is a markup language like HTML. XML was designed to describe data. You must define."— Presentation transcript:

1 XML CS 105

2 What is XML? XML stands for Extensible Markup Language. XML is a markup language like HTML. XML was designed to describe data. You must define your own tags.

3 An XML Example John Merry Reminder Don’t forget to pick up the box

4 Why XML? There is a huge number of websites on the web and each website posts tunes of web pages. Also the number of web sites increases day by day. It is getting harder to find the information we are looking for.

5 Why XML? We need search engines to locate the information that we are looking for. Most of the WWW documents are in HTML. Search engines can bring you tons of pages. Note that we humans are smart. Most of the times we can realize the content of a webpage by reading it. But computer programs are not and search engine is a computer program.

6 XML is the solution. HTML describes how to display a page. But it does nothing to describe the contents of a page. We need a language to convey the content of a web page. XML is the solution.

7 XML XML indicates: –What information is contained within a webpage. –Where that information is on the page.

8 XML and HTML XML is not a replacement for HTML XML was designed to describe data in a format that you want and to focus on what data is. HTML was designed to display data in a format that you prefer. HTML is about displaying information, while XML is about describing information

9 XML and HTML XML and HTML complement each other. XML describes the data. HTML displays the data.

10 eXtensible Markup Language XML is supported by many platforms and many tools. A lot of web applications are using XML now. eXtensible Markup Language

11 XML vs. HTML 1 kg apple 1/2 Sugar 1 kg white flour 250 g butter Place apples in a bowl. Toss with flour until covered. then,... 1Kg apple 1/2Kg Sugar 1 kg white flour 250 g butter Place apples in a bowl. Toss with flour until covered. ….

12 XML Labels the data Structures the data Example

13 Rules for Well-Formatted XML Every XML document must have a special tag: to tell web browser it is an xml file Every XML document must have a single, all- enclosing “root tag” Every XML element must have a corresponding closing tag Just as HTML, XML elements must be properly nested XML tags are case sensitive, and are different The value of an attribute must appear in quotation marks (either double or single quotation marks work)

14 XML Element Names Names can contain letters, numbers and other characters Names cannot begin with a number or an underscore Names cannot begin with the prefix “XML” or “xml” or “xML” etc. Names cannot contain spaces

15 Good, Bad, and Unparsable Common errors in XML: misspelling tag names, have more than one root-level element, forgetting to close an open quote If XML file is well-formed, the browser will display the file in a hierarchical fashion, otherwise, cannot load the file The XML file could be designed poorly although it is well-formed.

16 Good, Bad and Unparsable Bad example: …

17 Good, Bad and Unparsable Solution: … …

18 Design Tips Think logically and design accordingly Ex. Use … for cd collections If you want it, tag it Ex. Don’t use 10:00pm.. Use 10:00pm … Think generically Ex. Don’t use … … to group different networks Use NBC ABC Think hierarchically Start with a meaningful root element and work downward to successive levels of detail

19 What is XSL? XSL is a language that allows one to describe for a browser how to process an XML file. XSL can convert an XML file into another format XML file. XSL can convert an XML file into a non- XML file.

20 XSL The most common type of XSL processing is to convert XML file into HTML file which can be displayed by browsers. We will focus on this use of XSL. XSL is the bridge between XML and HTML. We can use XSL to have different HTML formats of the same data represented in XML. Separating data (contents) from style tags (display commands). Example:


Download ppt "XML CS 105. What is XML? XML stands for Extensible Markup Language. XML is a markup language like HTML. XML was designed to describe data. You must define."

Similar presentations


Ads by Google