SGML (Standard Generalized Markup Language) is a standard for defining the structure and
the content of documents through the use of tags. It was developed in the 1980s and serves
as the foundation for many other markup languages, including HTML (Hypertext Markup
Language) and XML (eXtensible Markup Language).
Here are the key aspects of SGML:
1. Markup Language: SGML uses a system of tags to describe the structure of documents.
For example, it defines how different pieces of content such as paragraphs, tables, or
headers should be arranged.
2. Document Structure: SGML allows for the creation of complex document types by defining
specific rules for the document structure. This flexibility makes it suitable for a wide range of
applications, from technical manuals to legal documents.
3. Extensibility: SGML allows for the creation of custom tags and structures, which is one
reason why it can be used for diverse applications.
4. Document Type Definition (DTD): SGML uses a DTD to define the structure and rules for
a particular type of document, specifying which elements are allowed, their attributes, and
their relationships.
5. Legacy: SGML has been largely superseded by XML, which is a simpler and more widely
adopted subset of SGML. However, SGML is still used in some industries that require
precise control over document formats, such as technical publishing and government
document management.
In summary, SGML is a powerful and flexible markup language for defining structured
documents, though it has been largely replaced by XML due to its complexity and the rise of
the web.
XML (eXtensible Markup Language) is a versatile, text-based format used for storing,
transporting, and exchanging structured data. Unlike HTML, which focuses on presentation,
XML is designed to store data in a self-descriptive manner, allowing it to be easily
interpreted by both humans and machines.
Key Features of XML:
1. Self-Descriptive Structure: XML documents are composed of a series of elements (tags)
that describe data. These elements can be nested to represent complex structures. Each
element typically has a start tag, content, and an end tag. For example:
<book>
<title>Learning XML</title>
<author>John Doe</author>
<year>2023</year>
</book>
2. Extensibility: One of the primary benefits of XML is that it is extensible. Users can define
their own tags (e.g., <person>, <address>, etc.) and create custom document structures
based on their needs, unlike HTML, which has predefined tags.
3. Hierarchical Structure: XML documents are hierarchical and organized in a tree-like
structure. This makes it easy to represent relationships between pieces of data, like parent-
child relationships between elements.
4. Human-Readable: XML is plain text, which makes it easy to read and edit by humans. The
structure of the data is clearly defined, so it is often used for data interchange between
different systems.
5. Platform and Language Independent: XML is platform-neutral and can be used across
different operating systems and applications, making it ideal for data interchange between
diverse environments.
6. Well-formed and Valid:
Well-formed: An XML document must follow basic syntax rules, such as properly closing
tags, case sensitivity, and having only one root element.
Valid: In addition to being well-formed, an XML document can be validated against a
Document Type Definition (DTD) or an XML Schema to ensure that it conforms to a
predefined structure.
7. Unicode Support: XML supports Unicode, which means it can store and transport text in
almost any language or script, making it a global standard for data exchange.
8. Separation of Content and Presentation: XML focuses on describing the structure of data,
leaving the presentation and formatting to other technologies such as CSS or XSLT
(Extensible Stylesheet Language Transformations).
Example of a Well-Formed XML Document:
<?xml version="1.0" encoding="UTF-8"?>
<library>
<book>
<title>XML for Beginners</title>
<author>Jane Smith</author>
<year>2024</year>
</book>
<book>
<title>Advanced XML Techniques</title>
<author>John Doe</author>
<year>2023</year>
</book>
</library>
Common Uses of XML:
1. Data Exchange: XML is widely used for exchanging data between different applications
and systems. For example, web services use XML-based formats like SOAP (Simple Object
Access Protocol) for communication.
2. Configuration Files: Many software applications use XML to store configuration settings
because of its structured, hierarchical nature. For instance, .xml files can store user
preferences, application settings, and system configurations.
3. Web Services: XML is heavily used in web services and APIs. WSDL (Web Services
Description Language) and SOAP, for example, rely on XML for defining and exchanging
messages between clients and servers.
4. Document Representation: XML is also used to represent complex documents, such as in
the case of XHTML, MathML, and SVG (Scalable Vector Graphics), where structured data
needs to be transported and rendered.
5. Data Serialization: XML can be used for serializing data to be saved or transmitted, and
then deserialized back into usable data by another system.
Advantages of XML:
Portability: XML files can be shared across different platforms and applications.
Flexibility: You can define your own tags and structure, making XML adaptable to various
industries and use cases.
Extensibility: New data types or tags can be added as needed without disrupting existing
systems.
Validation: XML provides mechanisms (such as DTDs or XML Schema) to ensure data
integrity.
Disadvantages of XML:
Verbosity: XML documents can be quite verbose, as every piece of data must be wrapped in
tags, making them larger in size compared to other formats like JSON.
Complexity: For simple data structures, XML can be overkill. In many cases, other data
formats like JSON are more lightweight and easier to work with.
Conclusion:
XML is a robust and flexible format designed to store and transport structured data. While it
has been largely superseded by lighter formats like JSON for many web-based applications,
it remains an essential technology for data exchange, document representation, and
configuration across various industries.
XHTML (eXtensible Hypertext Markup Language) is a web coding standard that combines
the flexibility of HTML (Hypertext Markup Language) with the stricter rules of XML
(eXtensible Markup Language). It was developed by the W3C (World Wide Web
Consortium) as a way to ensure a cleaner, more consistent structure for web documents.
Key Features of XHTML:
1. XML-Based: XHTML is essentially a reformulation of HTML as an XML application. This
means XHTML documents must be well-formed, with strict syntax rules. For example, all
tags must be properly closed, and attribute values must be quoted.
2. Stricter Syntax: XHTML follows stricter syntax rules compared to traditional HTML. Some
key rules include:
Tags must be properly nested.
All elements must be closed, even self-closing tags like <img /> or <br />.
Attribute names must be lowercase, and attribute values must be enclosed in quotation
marks.
3. Backward Compatibility with HTML: While XHTML is based on XML, it is designed to be
compatible with browsers that support HTML. This made it easier for developers to transition
from HTML to XHTML.
4. Error Handling: Because XHTML is XML, browsers cannot render documents with syntax
errors as they do with HTML. If an XHTML document has an error, the browser will not
display it, requiring more care in document creation.
5. Document Structure: An XHTML document requires a proper DOCTYPE declaration and
must be well-formed. The structure is generally like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>
6. Mobile and Web Device Support: One of the goals of XHTML was to improve the
accessibility of web content across different devices, including mobile phones. Since XHTML
documents are more structured and predictable, they are easier to process across a variety
of platforms.
Evolution and Use Today:
XHTML 1.0 was the most common version and came in three flavors: Strict, Transitional,
and Frameset.
HTML5 has largely replaced XHTML in modern web development because it incorporates
many features of XHTML, such as stricter parsing rules and better support for multimedia,
without being as rigid in syntax.
In conclusion, XHTML was an important step in the evolution of web standards, providing a
more structured and reliable approach than HTML. However, with the introduction of HTML5,
it has become less commonly used, though it remains relevant in certain situations where
stricter XML-based document processing is required.
DHTML (Dynamic HTML) is a term used to describe a collection of technologies used
together to create interactive and dynamic web pages. DHTML isn't a single technology
itself, but rather a combination of HTML, CSS, JavaScript, and the Document Object Model
(DOM) that allows for more dynamic and responsive content on web pages.
Key Components of DHTML:
1. HTML: The foundational structure of the web page, which provides the static content.
2. CSS: Used to control the presentation, styling, and layout of the HTML elements. In
DHTML, CSS can be dynamically modified to change the appearance of a webpage without
reloading it.
3. JavaScript: A scripting language used to create dynamic interactions on the page.
JavaScript allows you to manipulate the content, structure, and styles of HTML and CSS in
real-time.
4. DOM (Document Object Model): A programming interface for web documents. The DOM
allows JavaScript to interact with the HTML structure, modifying elements and attributes on
the page.
Features of DHTML:
1. Interactive Content: DHTML enables the creation of interactive elements like dropdown
menus, form validation, and live content updates. It allows users to interact with the page
without needing to reload the entire page.
2. Dynamic Page Updates: With DHTML, parts of a webpage can be updated dynamically
based on user interactions or other events, without reloading the page. For example, content
in a <div> element can change when a user clicks a button, or an image can change when a
mouse hovers over a link.
3. Animations and Effects: DHTML allows for animations and visual effects. For example,
elements can fade in or slide across the screen, or a box can grow or shrink in response to
user input.
4. Event Handling: DHTML relies heavily on event-driven programming. Events such as
clicks, mouse movements, or key presses trigger JavaScript functions that modify the DOM
and CSS.
5. Cross-Browser Functionality: One of the challenges of DHTML in its early days was
ensuring that dynamic elements worked consistently across different web browsers, as
browser support for JavaScript and CSS varied widely. Over time, this has become less of
an issue with the rise of modern standards.
Example of DHTML:
Here's a simple example of a DHTML effect where a box changes color when the user
moves the mouse over it:
<!DOCTYPE html>
<html>
<head>
<style>
#dynamicBox {
width: 200px;
height: 100px;
background-color: lightblue;
transition: background-color 0.3s ease;
}
</style>
<script>
function changeColor() {
document.getElementById("dynamicBox").style.backgroundColor = "lightgreen";
}
function resetColor() {
document.getElementById("dynamicBox").style.backgroundColor = "lightblue";
}
</script>
</head>
<body>
<div id="dynamicBox" onmouseover="changeColor()" onmouseout="resetColor()">
Hover over me to change color!
</div>
</body>
</html>
In this example:
HTML defines the structure of the page.
CSS provides the initial styling of the box.
JavaScript is used to dynamically change the background color of the box when the mouse
hovers over it (using the onmouseover and onmouseout events).
Advantages of DHTML:
1. Improved User Experience: DHTML allows websites to provide a more interactive and
engaging experience without needing to reload entire pages.
2. Efficiency: With DHTML, only portions of the web page are modified, reducing the load on
the server and making the web page feel faster.
3. Rich Interactivity: It enables rich user interfaces, like dynamic menus, real-time updates,
and interactive forms.
Disadvantages of DHTML:
1. Compatibility Issues: DHTML initially faced compatibility problems between browsers,
especially with older browsers. However, this issue is mostly resolved today with the
evolution of web standards.
2. Performance: Excessive use of JavaScript for dynamic content updates can slow down
performance, especially on older devices or browsers.
3. Complexity: Building complex dynamic pages with DHTML can sometimes lead to
complicated and hard-to-maintain code.
Modern Evolution:
While DHTML was groundbreaking in the early days of the web, many of its features are
now commonly handled by modern JavaScript libraries and frameworks like jQuery, React,
Vue.js, and Angular. These tools offer much more powerful and efficient ways of creating
dynamic, interactive web applications.
In conclusion, DHTML was a significant step in the development of interactive websites,
providing a foundation for the modern web. However, with the rise of JavaScript libraries and
frameworks, much of its functionality has been absorbed into more advanced, easier-to-use
technologies.
HTML (HyperText Markup Language) is the standard language used to create and design
the structure of web pages. It uses a system of elements and tags to define the layout and
content of a webpage, including text, images, links, videos, and other multimedia.
Key Features of HTML:
1. Structure: HTML provides the basic framework for a webpage. Tags like <html>, <head>,
and <body> define the overall layout.
2. Elements: Elements are building blocks of HTML, usually represented by opening and
closing tags (e.g., <p> for paragraphs, <h1> for headings).
3. Attributes: Attributes provide additional information about elements, such as id, class, or
href (for links).
4. Hyperlinks: Using the <a> tag, HTML allows linking to other pages or resources.
5. Multimedia: HTML supports images (<img>), videos (<video>), and audio (<audio>).
6. Forms: HTML includes elements like <form>, <input>, and <button> for user input and
interaction.
7. Compatibility: HTML is platform-independent and works seamlessly across web browsers.
Modern Usage:
HTML5, the latest version, introduced new features like:
Semantic Tags: Elements like <header>, <footer>, and <article> improve accessibility and
readability.
Native Multimedia: Support for video and audio without external plugins.
Responsive Design: Integration with CSS and JavaScript for mobile-friendly web
development.
HTML is essential for web development, forming the foundation upon which CSS (for styling)
and JavaScript (for interactivity) are layered.
HTML Vs XML
HTML (HyperText Markup Language) and XML (eXtensible Markup Language) are both
markup languages used for structuring and presenting data. However, they serve different
purposes and have distinct characteristics. Here's a comparison:
1. Purpose
HTML: Used to create and display web pages and user interfaces. It focuses on how data
looks (presentation).
XML: Designed to store and transport data. It focuses on what the data is (structure and
meaning).
2. Syntax Rules
HTML: Has a set of predefined tags (like <div>, <p>, <img>), and its syntax is lenient (e.g.,
missing closing tags are often tolerated).
XML: Has strict rules and is case-sensitive. Every opening tag must have a corresponding
closing tag, and all elements must be properly nested.
3. Flexibility
HTML: Fixed vocabulary; you cannot create new tags.
XML: Extensible; you can define your own tags and structure based on your needs.
4. Data Representation
HTML: Displays data in a web browser, with tags defining the visual structure.
XML: Represents data in a structured format for data exchange between systems (e.g.,
APIs).
5. Error Handling
HTML: Browsers often interpret and display HTML even if it contains errors.
XML: Strict error handling; malformed XML will not be processed.
6. Usage
HTML: Used in web development to design web pages.
XML: Used in various applications for data storage, exchange, and configuration files (e.g.,
RSS feeds, SOAP, and configuration settings).
7. Integration
HTML: Focuses on combining with CSS and JavaScript for interactive and styled web
pages.
XML: Commonly paired with technologies like XSLT, XPath, and schemas (XSD) for data
transformation and validation.
Summary Table
In essence, HTML is presentation-oriented, while XML is data-oriented.