0% found this document useful (0 votes)
22 views

HTML & XML - Unit 5

HTML is a markup language used to define the structure and layout of web pages. It uses tags like <h1> and <p> to label document elements and tell browsers how to display content. XML is a similar language used to store and transport structured data between systems. While HTML focuses on display, XML focuses on meaning and structure. Both languages use tags to define elements, with XML allowing custom tags for specific applications.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

HTML & XML - Unit 5

HTML is a markup language used to define the structure and layout of web pages. It uses tags like <h1> and <p> to label document elements and tell browsers how to display content. XML is a similar language used to store and transport structured data between systems. While HTML focuses on display, XML focuses on meaning and structure. Both languages use tags to define elements, with XML allowing custom tags for specific applications.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

What is HTML?

 HTML stands for Hyper Text Markup Language


 HTML is the standard markup language for creating Web pages
 HTML describes the structure of a Web page
 HTML consists of a series of elements
 HTML elements tell the browser how to display the content
 HTML elements label pieces of content such as "this is a heading", "this is a paragraph",
"this is a link", etc.

A Simple HTML Document


Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>
Example Explained

 The <!DOCTYPE html> declaration defines that this document is an HTML5 document
 The <html> element is the root element of an HTML page
 The <head> element contains meta information about the HTML page
 The <title> element specifies a title for the HTML page (which is shown in the browser's
title bar or in the page's tab)
 The <body> element defines the document's body, and is a container for all the visible
contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
 The <h1> element defines a large heading
 The <p> element defines a paragraph
What is an HTML Element?

An HTML element is defined by a start tag, some content, and an end tag:

<tagname>Content goes here...</tagname>

The HTML element is everything from the start tag to the end tag:

<h1>My First Heading</h1>


<p>My first paragraph.</p>

Start tag Element content End


tag

<h1> My First Heading </h1>

<p> My first paragraph. </p>

<br> none none

Note: Some HTML elements have no content (like the <br> element). These elements are called
empty elements. Empty elements do not have an end tag!

Web Browsers

The purpose of a web browser (Chrome, Edge, Firefox, Safari) is to read HTML documents and
display them correctly.

A browser does not display the HTML tags, but uses them to determine how to display the
document:
HTML Page Structure

Below is a visualization of an HTML page structure:

<html>
<head>
<title>Page title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>

Note: The content inside the <body> section (the white area above) will be displayed in a
browser. The content inside the <title> element will be shown in the browser's title bar or in the
page's tab.
 A markup language is a computer language that uses tags to define elements within a
document. It is human-readable, meaning markup files contain standard words, rather
than typical programming syntax.
 While several markup languages exist, the two most popular are HTML and XML.
 HTML is a markup language used for creating webpages.
 The contents of each webpage are defined by HTML tags. Basic page tags, such
as <head>, <body>, and <div> define sections of the page,
 while tags such as <table>, <form>, <image>, and <a> define elements within the page.
 Most elements require a beginning and end tag, with the content placed between the tags.
 For example, a link to the TechTerms.com home page may use the following HTML
code:

<a href="https://techterms.com">TechTerms.com</a>

 XML is used for storing structured data, rather than formatting information on a page.
 While HTML documents use predefined tags (like the examples above),
 XML files use custom tags to define elements.
 For example, an XML file that stores information about computer models may include
the following section:

<computer>
<manufacturer> Dell </manufacturer>
<model> XPS17 </model>
<components>
<processor> 2.00GHz Intel Core i7</processor>
<ram> 6GB </ram>
<storage> 1TB </storage>
</components>
</computer>
 XML is called the "Extensible Markup Language" since custom tags can be used to
support a wide range of elements.
 Each XML file is saved in a standard text format, which makes it easy for software
programs to parse or read the data.
 Therefore, XML is a common choice for exporting structured data and for sharing data
between multiple programs.

XML stands for Extensible Markup Language.


 It is a text-based markup language derived from Standard Generalized Markup
Language (SGML).
 XML tags identify the data and are used to store and organize the data, rather than
specifying how to display it like HTML tags, which are used to display the data.
 XML is not going to replace HTML in the near future, but it introduces new possibilities
by adopting many successful features of HTML.

There are three important characteristics of XML that make it useful in a variety of systems and
solutions −
 XML is extensible − XML allows you to create your own self-descriptive tags, or
language, that suits your application.
 XML carries the data, does not present it − XML allows you to store the data
irrespective of how it will be presented.
 XML is a public standard − XML was developed by an organization called the World
Wide Web Consortium (W3C) and is available as an open standard.

XML Usage

A short list of XML usage says it all −


 XML can work behind the scene to simplify the creation of HTML documents for large
web sites.
 XML can be used to exchange the information between organizations and systems.
 XML can be used for offloading and reloading of databases.
 XML can be used to store and arrange the data, which can customize your data handling
needs.
What is Markup?

XML is a markup language that defines set of rules for encoding documents in a format that is
both human-readable and machine-readable.

So what exactly is a markup language? Markup is information added to a document that


enhances its meaning in certain ways, in that it identifies the parts and how they relate to each
other.

More specifically, a markup language is a set of symbols that can be placed in the text of a
document to demarcate and label the parts of that document.

Following example shows how XML markup looks, when embedded in a piece of text −
<message>
<text>Hello, world!</text>
</message>
This snippet includes the markup symbols, or the tags such as <message>...</message> and
<text>... </text>.

The tags <message> and </message> mark the start and the end of the XML code fragment.
The tags <text> and </text> surround the text Hello, world!.

You might also like