CAP UNIT-2-1 HTMP and XML Notes
CAP UNIT-2-1 HTMP and XML Notes
HTML
HTML (Hypertext Markup Language) is the standard markup language used for creating and
structuring web pages. It forms the foundation of the World Wide Web and is essential for
building websites and web applications. HTML uses a set of markup tags to define the structure
and content of a webpage, allowing browsers to interpret and display the information correctly.
HTML stands for Hyper Text Markup Language. It is used to design web pages using markup
language. HTML is the combination of Hypertext and Markup language. Hypertext defines the
link between the web pages. Markup language is used to define the text document within tag
which defines the structure of web pages.
This language is used to annotate (make notes for the computer) text so that a machine can
understand it and manipulate text accordingly. Most of markup (e.g. HTML) languages are
human readable. Language uses tags to define what manipulation has to be done on the text.
HTML is a markup language which is used by the browser to manipulate text, images and other
content to display it in required format.
HTML was created by Tim Berners-Lee in 1991. The first ever version of HTML was HTML
1.0 but the first standard version was HTML 2.0 which was published in 1999.HTML is the
standard markup language for creating Web pages.
Introduction to HTML:
Structure of HTML:
Example-1: Working of HTML
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
OUTPUT:
Features of HTML:
It is easy to learn and easy to use.
It is platform independent.
Images, video and audio can be added to a web page.
Hypertext can be added to text.
It is a markup language.
Advantages:
HTML is used to build a websites.
It is supported by all browsers.
It can be integrated with other languages like CSS, JavaScript etc.
Disadvantages:
HTML can create only static webpages so for dynamic web page other languages have to be
used.
Large amount of code has to be written to create a simple web page.
Security feature is not good.
Introduction to XML
XML (eXtensible Markup Language) is a widely used markup language designed to store and
transport structured data. It provides a flexible and self-describing format for representing
information in a machine-readable and human-readable manner.
XML was developed by the World Wide Web Consortium (W3C) as a standard for exchanging
data between different systems and platforms.
1. Markup Language: XML uses tags to define elements and structure data. It allows users
to define their own tags, making it highly flexible and extensible. Tags are enclosed in angle
brackets (<>) and can be nested to create a hierarchical structure.
2. Self-Describing: XML documents are self-describing, meaning they contain both the
data and the metadata that describes the structure and meaning of the data. This makes it easier
for applications to interpret and process the information.
3. Hierarchical Structure: XML documents have a hierarchical structure, organized in a
tree-like fashion. Elements can have parent-child relationships, forming a tree structure where
elements can contain other elements or data.
4. Tags and Elements: Tags represent the markup structure in XML. They define the
beginning and end of an element and give it a name. Elements can have attributes, which provide
additional information about the element. The data or content within an element is enclosed
between the opening and closing tags.
5. Attributes: Attributes provide additional information about elements. They consist of a
name-value pair and are specified within the opening tag of an element. Attributes are useful for
providing metadata or additional details about the elements.
6. Well-Formedness and Validity: XML documents must adhere to certain rules to be
considered well-formed. This includes having a single root element, properly nested elements,
and correctly closed tags. Additionally, XML can have a Document Type Definition (DTD) or
XML Schema to define the structure and validate the document against a specific set of rules.
7. Data Exchange: XML is commonly used for data exchange between different systems or
applications. It provides a standardized format that can be easily parsed and processed by various
programming languages and platforms.
8. Extensibility: XML allows users to define their own tags and structure, making it highly
extensible. This flexibility enables customization and adaptation to specific data requirements.
Structure of XML:
Advantages of XML
1. XML is platform independent and programming language independent, thus it can be used on
any system and supports the technology change when that happens.
2. XML supports unicode. Unicode is an international encoding standard for use with different
languages and scripts, by which each letter, digit, or symbol is assigned a unique numeric value
that applies across different platforms and programs. This feature allows XML to transmit any
information written in any human language.
3. The data stored and transported using XML can be changed at any point of time without
affecting the data presentation. Generally other markup language such as HTML is used for data
presentation, HTML gets the data from XML and display it on the GUI (graphical user
interface), once data is updated in XML, it does reflect in HTML without making any change in
HTML GUI.
4. XML allows validation using DTD and Schema. This validation ensures that the XML
document is free from any syntax error.
5. XML simplifies data sharing between various systems because of its platform independent
nature. XML data doesn’t require any conversion when transferred between different systems.
Disadvantages of XML
1. XML syntax is verbose and redundant compared to other text-based data transmission formats
such as JSON.
2. The redundancy in syntax of XML causes higher storage and transportation cost when the
volume of data is large.
3. XML document is less readable compared to other text-based data transmission formats such
as JSON.
4. XML doesn’t support array.
5. XML file sizes are usually very large due to its verbose nature, it is totally dependant on who
is writing it.
XML HTML
The full form is eXtensible Markup Language The full form is Hypertext Markup Language
The main purpose is to focus on the transport Focusses on the appearance of data. Enhances the
of data and saving the data appearance of text
XML is dynamic because it is used in the HTML is static because its main function is in the
transport of data display of data
It is case-sensitive. The upper and lower case It is not case-sensitive. Upper and lower case are of not
needs to be kept in mind while coding much importance in HTML
You can define tags as per your requirement, It has its own pre-defined tags, and it is not necessary
but closing tags are mandatory to have closing tags
XML can preserve white spaces White spaces are not preserved in HTML
eXtensible Markup Language is content- Hypertext Markup Language, on the other hand, is
driven, and not many formatting features are presentation driven. How the text appears is of utmost
available importance
Any error in the code shall not give the final Small errors in the coding can be ignored and the
outcome outcome can be achieved
The size of the document may be large No lengthy documents. Only the syntax needs to be
added for best-formatted output