0% found this document useful (0 votes)
12 views8 pages

Unit-2 HTML Notes- Part 1

Chapter 2 discusses markup languages, focusing on HTML and XML. HTML is used for creating web documents with a structure defined by tags, while XML allows users to create custom markup languages for sharing structured data. The chapter also covers the syntax, creation, advantages, and disadvantages of both HTML and XML.

Uploaded by

Uttam Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views8 pages

Unit-2 HTML Notes- Part 1

Chapter 2 discusses markup languages, focusing on HTML and XML. HTML is used for creating web documents with a structure defined by tags, while XML allows users to create custom markup languages for sharing structured data. The chapter also covers the syntax, creation, advantages, and disadvantages of both HTML and XML.

Uploaded by

Uttam Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

Chapter 2: Markup Languages

2.1 HYPERTEXT MARKUP LANGUAGE (HTML)


HTML or Hypertext Markup Language is a markup language used to create
documents on the World Wide Web. It defines the structure and layout of a
Web document by using a variety of tags and attributes. A markup
language is a set of interpretations to text that describe how it is to be
structured, laid out, or formatted.

The tags are predefined combinations of characters enclosed between <


(less than) and > (greater than) characters. These < and > characters are
called as angular brackets. The tags are embedded within the text of a file,
and they indicate how the text is to be interpreted and displayed by the
browser.

How a Web page looks when displayed depends on three things:

1. The HTML tags used.


2. The specific browser rendering the page.
3. The user’s system and monitor.

HTML tags do not define exactly how the Web page is supposed to look;
rather, the tags describe how the elements of the page, such as headings,
lists, paragraphs, and so on, are to be used.

HTML is not case sensitive, i.e., the tags either in uppercase like <HTML> or
the tags in lower case like <html> means the same as <Html>.

2.1.1 HTML Tag Syntax

The basic form of HTML tags can be written abstractly as:

<TAG ATTRIB1 = “VALUE1” ATTRIB2 = “VALUE2”> item to be


formatted

</TAG>

where ATTRIB means attribute. TAG means any HTML tag.

The number of attributes varies from tag to tag. An attribute can have
several values to be selected. Every HTML tag has a closing tag or an
ending tag as </TAG>. However, some of the tags might work without
the ending tags.

HTML is not case sensitive, i.e., the tags either in uppercase like
<HTML> or the tags in lower case like <html> means the same as
<Html>.
Markup Languages

2.1.2 HTML Document Creation

To produce an HTML document, a text editor is needed to create an


ASCII file with an extension .html or .htm. An HTML document is
created using the <HTML> and </HTML> tags in a text editor, that may
be a notepad or the word pad.

Every HTML document has two parts: a head and a body. These parts
can be distinguished by using following tags:

<HEAD> and </HEAD> for the head part.

<BODY> and </BODY> for the body part.

A title tag, <TITLE>, is contained within the head of the document to


provide a title for the document, with a corresponding closing tag
</TITLE>. The title should provide a concise description of the page,
since the title is prominently displayed in the browser window’s Title bar
when the page is being viewed.

For example, consider the following HTML document, “sample . html”:

<HTML>

<HEAD>

<TITLE> Internet Fundamentals</TITLE>

</HEAD>

<BODY>

This is my first Web page. Welcome to the Web World. This is an


example of Internet Fundamentals.

</BODY>

</HTML>
Markup Languages

After creating the HTML document as mentioned above, the page will be
displayed as follows:

2.2 EXTENSIBLE MARKUP LANGUAGE (XML)


The Extensible Markup Language (XML) is a general-purpose
specification for creating custom markup languages. It is classified as an
extensible language because it allows its users to define their own elements.
Its primary purpose is to facilitate the sharing of structured data across
different information systems, particularly via the Internet.

2.2.1 Syntax of XML

XML is a generic framework for storing any amount of text or any data
whose structure can be represented as a tree. The only requirement is
that the text must be enclosed between a start tag and a corresponding
end tag. For example,

<BOOK> This is a book… </BOOK>

< ? XML VERSION = “1.0” ENCODING = “UTF – 8” ? >

This element states what version of XML is in use. It may also contain
information about character encoding.
Markup Languages
The root element can be preceded by this optional XML declaration.

Comments can be placed anywhere in the tree,

< ! - - This is a comment - - >

The basic syntax of an element is:

<NAME ATTRIBUTE = “value”> text </NAME>

Tree structure of an XML document:

<ROOT>

<CHILD>

<SUBCHILD> … </SUBCHILD>

</CHILD>

</ROOT>

For example,

<BOOKSTORE>

<BOOK CATEGORY = “children”>

<TITLE> Harry Potter </TITLE>

<AUTHOR> J.K. Rowling </AUTHOR>

<YEAR> 2005 </YEAR>

<PRICE> 29.99 </PRICE>

</BOOK>

<BOOK CATEGORY = “web”>

<TITLE> Learning XML </TITLE>

<AUTHOR> Erik T. Ray </AUTHOR>

<YEAR> 2003 </YEAR>

<PRICE> 39.95 </PRICE>

</BOOK>

</BOOKSTORE>
Markup Languages
After creating the XML document as mentioned above, the page will be
displayed as follows:

2.2.2 Advantages of XML

1. It is text – based.
2. It can represent common computer science data structures:
records, lists, and trees.
3. Its self documenting format describes structure and field names
as well as specific values.
4. It is platform – independent.
5. It can be updated incrementally.

2.2.3 Disadvantages of XML


Markup Languages
1. XML syntax is redundant or large relative to binary
representations of similar data.
2. The redundancy may affect application efficiency through higher
storage, transmission, and processing costs.
3. Expressing non – hierarchical node relations requires extra
effort.

2.3 Anatomy of Hypertext Markup Language


Document
A Web page consists of a file which contains the text of the page, and which
also contains codes or tags to tell the browser how to display the page. Any
other elements, such as images, sound clips, video clips, or even small
programs which calculate spreadsheets, are separate files. A moderately
graphic page may be made of up to 20 files.

The tags used to tell the browser how to display pages are written according
to a set of rules (a syntax) and the collection of tags and rules for using
them to make a page is known as the Hypertext Mark Up Language.

 'Hypertext' means text documents which can be linked together


 'Marking up' a page is the process of adding the codes to the text,
this is borrowed from printer's slang
 'Language', not in the sense of German or BASIC, but simply there
are rules to combining the tags

Below are the HTML tags or codes for a simple Web page.

<HTML>

<HEAD>
<TITLE>
My page
</TITLE>
</HEAD>

<BODY>
<H1>Joe Bloggs</H1>
<HR>

<P>This is a page about <EM>me</EM> and what I do. I can

<UL>
<LI>Shell peas
<LI>Peel potatoes
<LI>Write C++ programs
</UL>

<HR>
Markup Languages
</BODY>
</HTML>

If you

 copy and paste the page above into Notepad or SimpleText


 save the file as (say) mypage.htm
 load mypage.htm into a browser

you will see something like this


Markup Languages

You might also like