Markup Languages - PowerPoint PPT Presentation

About This Presentation
Title:

Markup Languages

Description:

BODY BGCOLOR='#CCFFFF' Here is the content of the page /BODY /HTML HTML Components ... BGCOLOR is an example. Name value pairs. BGCOLOR='#CCFFFF' ... – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 31
Provided by: pant152
Category:

less

Transcript and Presenter's Notes

Title: Markup Languages


1
(No Transcript)
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
  • ltHTMLgt
  • ltHEADgt
  • ltTITLEgtThe Titlelt/TITLEgt
  • lt/HEADgt
  • ltBODY BGCOLORCCFFFFgt
  • Here is the content of the page
  • lt/BODYgt
  • lt/HTMLgt

4
HTML Components
  • Tags are enclosed in lt gt
  • Tags are closed with a /
  • Elements are an opened and closed tag
  • Example ltTITLEgtThe Titlelt/TITLEgt

5
HTML Attributes
  • Tags can have attributes
  • BGCOLOR is an example
  • Name value pairs
  • BGCOLORCCFFFF
  • 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. ltbgtHellolt/bgt
  • ltbgtboldlt/bgt and ltigtitalicizedlt/igt
  • 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
lt?xml version"1.0"?gt ltPersongt ltnamegtAlanlt/nam
egt ltaddressgtAbbeydale roadlt/addressgt ltcitygtSheff
ieldlt/citygt ltgendergtMalelt/gendergt lt/Persongt lt!--T
his is a comment--gt
Prolog
BODY
Epilog
10
Another example of the same XML File
ltPersongt ltnamegtSarahlt/namegt ltaddressgt42,
Oldbridge Courtlt/addressgt ltaddressgtOldbridge
Roadlt/addressgt ltcitygtLondonlt/citygt ltgendergtFemal
elt/gendergt lt/Persongt
11
Creating an XML Document Overview
  • Research XML Applications
  • Create a data model
  • Write the XML document
  • Test the XML document

12
XML Snippet
  • ltcustomergt
  • ltnamegtJohn Smithlt/namegt
  • ltagegt35lt/agegt
  • lt/customergt

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
  • Height65
  • Any element may have an attribute
  • Two reserved attributes
  • Xmlspace and xmllang

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
  • amp lt gt are typical character references

18
XML Comments
  • Just like HTML comments
  • lt!--This is a comment--gt

19
Tools used to develop HTML XML Documents
HTML You can develop HTML documents in
FrontPage or Dreamweaver XML - You can develop
XML documents in XMLSpy
20
The main difference between XML and HTML
XML HTML
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,
21
XML Syntax
The syntax rules of XML are very simple and very
Strict. Lets start by reviewing a simple XML
file
lt?xml version"1.0" encoding"ISO-8859-1" ?gt
ltnotegt   lttogtTovelt/togt
ltfromgtJanilt/fromgt   ltheadinggtReminderlt/headinggt
  ltbodygtDon't forget me this weekend!lt/bodygt
lt/notegt
22
A simple XML file containing data about an Email
This line defines that this is an XML file
lt?xml version"1.0" encoding"ISO-8859-1" ?gt
ltnotegt   lttogtTovelt/togt
ltfromgtJanilt/fromgt   ltheadinggtReminderlt/headinggt
  ltbodygtDon't forget me this weekend!lt/bodygt
lt/notegt
This is the root element
These are the child elements
23
The same XML file with an error
lt?xml version"1.0" encoding"ISO-8859-1" ?gt
ltnotegt lttogtTovelt/togt ltfromgtJanilt/Ffromgt
ltheadinggtReminderlt/headinggt
ltbodygtDon't forget me this weekend!lt/bodygt
lt/notegt 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 ltfromgtJanilt/Ffromgt -------------
24
XML Syntax
25
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 ltbookgt lttitlegtMy First XMLlt/titlegt ltprod
id"33-657" media"paper"gtlt/prodgt ltchaptergtIntrod
uction to XML ltparagtWhat is HTMLlt/paragt
ltparagtWhat is XMLlt/paragt lt/chaptergt
ltchaptergtXML Syntax ltparagtElements must have
a closing taglt/paragt ltparagtElements must be
properly nestedlt/paragt lt/chaptergt lt/bookgt
28
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
XML was not designed to DO anything
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 ltnotegt lttogtTovelt/togt
ltfromgtJanilt/fromgt ltheadinggtReminderlt/headinggt
ltbodygtDon't forget me this weekend!lt/bodygtlt/not
egt 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.
Write a Comment
User Comments (0)
About PowerShow.com