Presentation is loading. Please wait.

Presentation is loading. Please wait.

How do I use HTML and XML to present information?.

Similar presentations


Presentation on theme: "How do I use HTML and XML to present information?."— Presentation transcript:

1 How do I use HTML and XML to present information?

2 Markup Languages Set of commands that tell a program how to display content Written in plain text Browser converts markup language to a visual display HTML, XML are markup languages

3 Basic HTML Document The Title Here is the content of the page

4 HTML Components Tags are enclosed in Tags are closed with a / Elements are an opened and closed tag –Example The Title

5 HTML Attributes Tags can have attributes BGCOLOR is an example Name value pairs –BGCOLOR=“#CCFFFF” –BGCOLOR is the name, #CCFFFF is the value Minimized attributes have no value –SELECTED –BGFIXED

6 HTML Components In HTML each tag has a meaning. e.g. Hello bold and italicized You can embed you data in these tags to present the information on the Web. This structure is defined in a DTD, a Document Type Definition

7 XML Basics XML - EXtensible Markup Language XML is much like HTML Elements and tags Developer can create new tags as needed Document content is described rather than format Must be well formed (more about this later)

8 XML Document Sections An XML document can have the following three sections Prolog (optional) Stuff before the top-level, start-tag is called the "prolog". Body Epilog (optional) Stuff after the top-level, end-tag is called the "epilog"

9 Sample XML File Alan Abbeydale road Sheffield Male BODY Prolog Epilog

10 Another example of the same XML File Sarah 42, Oldbridge Court Oldbridge Road London Female

11 Creating an XML Document Overview Research XML Applications Create a data model Write the ‘XML’ document Test the XML document

12 XML Snippet John Smith 35

13 XML Entities and Data Entities are XML files or documents Data is part of an XML document May be parsed or unparsed –Parsed holds all character data –Unparsed holds character or non character data

14 XML Names Attributes and elements will be named Standard programming rules apply –No spaces –Must begin with a letter –No _ or : Name must not start with XML in any case

15 XML Elements Fields in the XML document Elements are often nested hierarchically –Must be nested correctly All tags must have an ending tag Elements may have attributes

16 XML Attributes Must be in name-value pair format –Height=“65” Any element may have an attribute Two reserved attributes –Xml:space and xml:lang

17 XML Character Data Character data is text in the document, not markup tags Certain characters are reserved and must be entered using character references & < > are typical character references

18 XML Comments Just like HTML comments

19 HTML – You can develop HTML documents in FrontPage or Dreamweaver XML - You can develop XML documents in XMLSpy Tools used to develop HTML & XML Documents

20 XMLHTML XML was designed to carry data. XML was designed to describe data and to focus on what data is HTML was designed to display data and to focus on how data looks. XML is about describing information HTML is about displaying information, The main difference between XML and HTML

21 XML Syntax The syntax rules of XML are very simple and very Strict. Lets start by reviewing a simple XML file Tove Jani Reminder Don't forget me this weekend!

22 Tove Jani Reminder Don't forget me this weekend! This is the root element These are the child elements This line defines that this is an XML file A simple XML file containing data about an Email

23 Tove Jani Reminder Don't forget me this weekend! The XML page cannot be displayed cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. End tag 'Ffrom' does not match the start tag 'from'. Line 5, Position 14 Jani -------------^ The same XML file with an error

24 All XML elements must have a closing tag In HTML, you would write This is a paragraph In XML, you would write This is a paragraph XML Tags are case sensitive This is incorrect Phil This is correct Phil XML Syntax

25 All XML elements must be properly nested This is incorrect Tove This is correct Tove All XML documents must have a root tag and only one root tag XML Syntax

26 XML ELEMENTS XML Elements have Relationships XML elements have a child parent relationship Lets review the following structure Book Title: My First XML Chapter 1: Introduction to XML What is HTML What is XML Chapter 2: XML Syntax Elements must have a closing tag Elements must be properly nested

27 XML ELEMENTS The book details structure in XML would look like My First XML Introduction to XML What is HTML What is XML XML Syntax Elements must have a closing tag Elements must be properly nested

28 Book is the root element. Title, prod, and chapter are child elements of book. Book is the parent element of title, prod, and chapter. Title, prod, and chapter are siblings (or sister elements) because they have the same parent. XML ELEMENTS

29 "Well Formed" XML documents A "Well Formed" XML document has correct XML syntax. A "Well Formed" XML document is a document that conforms to the XML syntax rules that were described in the previous slides

30 Maybe it is a little hard to understand, but XML does not DO anything. XML is created to structure, store, and to send information. The following example is a note to Tove from Jani, stored as XML: Tove Jani Reminder Don't forget me this weekend! The note has a header, and a message body. It also has sender and receiver information. But still, this XML document does not DO anything. It is just pure information wrapped in XML tags. Someone must write a piece of software to send, receive, or display it. XML was not designed to DO anything


Download ppt "How do I use HTML and XML to present information?."

Similar presentations


Ads by Google