Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Explain different markup languages other than HTML
Markup languages are computer languages that use symbols or tags to structure, format, and describe relationships between portions of text documents. Unlike traditional programming languages with strict syntax, markup languages are designed to be more human-readable and easier to understand. While HTML is the most widely known markup language for web development, several other markup languages serve different purposes and offer unique capabilities.
XML (Extensible Markup Language)
XML is a markup language designed to store and transport structured data using custom-defined tags. Unlike HTML, which has predefined tags for presentation, XML allows developers to create their own tags to describe data meaningfully. XML focuses on what the data is rather than how it appears, making it ideal for data exchange between different systems and applications.
Syntax
Following is the basic syntax structure of XML
<?xml version="1.0" encoding="UTF-8"?> <root> <element>data</element> <element attribute="value">more data</element> </root>
Example XML Message Structure
Following example demonstrates XML used to structure a message with custom tags
<!DOCTYPE html> <html> <head> <title>XML Example</title> </head> <body style="font-family: Arial, sans-serif; padding: 20px;"> <h3>XML Message Structure:</h3> <pre style="background: #f4f4f4; padding: 15px; border-left: 4px solid #007acc;"><?xml version="1.0" encoding="UTF-8"?> <message> <to>Customer</to> <from>TutorialsPoint</from> <subject>Choose The Course</subject> <text>Apply Coupon for Discount</text> <priority>high</priority> </message></pre> <p>This XML structure clearly defines each data element with meaningful tags.</p> </body> </html>
Features of XML
Platform Independent Works across different operating systems and hardware.
Self-Descriptive Tags describe the data content, making it easily understandable.
Extensible Allows creation of custom tags for specific data needs.
Unicode Support Handles international characters and symbols.
Hierarchical Structure Supports nested elements for complex data relationships.
Drawbacks of XML
Verbose Syntax Requires more characters than JSON for the same data.
Large File Sizes Tag redundancy increases storage and bandwidth costs.
Processing Overhead Parsing XML requires more computational resources.
XHTML (Extensible Hypertext Markup Language)
XHTML is a reformulation of HTML as an XML application, combining HTML's presentation capabilities with XML's strict structural rules. It requires proper nesting, closing tags, and well-formed markup. XHTML documents must validate against a DTD (Document Type Definition) and follow stricter syntax rules than HTML.
Syntax
Following is the basic XHTML document structure
<?xml version="1.0" encoding="UTF-8"?>
<!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>Page Title</title>
</head>
<body>
<p>Content goes here</p>
</body>
</html>
XHTML documents must include three types of DTD declarations
Strict DTD Excludes deprecated HTML elements
Transitional DTD Includes some deprecated elements for backward compatibility
Frameset DTD Used for documents containing frames
Example XHTML Document
Following example shows a properly structured XHTML document
<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en" lang="en">
<head>
<title>XHTML Example</title>
<style type="text/css">
.header { color: #090; font-size: 48px; font-weight: bold; text-align: center; }
.tagline { text-align: center; font-size: 20px; color: #666; }
</style>
</head>
<body>
<div class="header">TUTORIALSPOINT</div>
<p class="tagline">The Best E-Way Learning Platform</p>
</body>
</html>
The output displays a properly formatted webpage with the specified styling
TUTORIALSPOINT (large, green, bold, centered) The Best E-Way Learning Platform (smaller, gray, centered)
Features of XHTML
XML-Based Structure Follows XML syntax rules for better document structure.
Strict Validation Enforces proper markup syntax and nesting.
Cross-Platform Compatibility Works consistently across different browsers and devices.
Machine-Readable Can be processed by XML tools and parsers.
Drawbacks of XHTML
Strict Syntax Requirements More challenging to write than HTML due to rigid rules.
Error Sensitivity Small markup errors can prevent the page from rendering.
Limited Browser Support Some older browsers may not handle XHTML properly.
SGML (Standard Generalized Markup Language)
SGML is a standard for defining markup languages and serves as the foundation for both HTML and XML. It provides a framework for creating document markup languages that are independent of specific applications or systems. SGML is particularly useful for large, complex documents that require regular modifications and need to maintain consistency across different platforms.
Syntax
Following is the basic SGML document structure
<!DOCTYPE document [ <!ELEMENT document (title, content)> <!ELEMENT title (#PCDATA)> <!ELEMENT content (#PCDATA)> ]> <document> <title>Document Title</title> <content>Document content goes here</content> </document>
Example SGML Document Structure
Following example demonstrates the structure of an SGML document
<!DOCTYPE html>
<html>
<head>
<title>SGML Structure Example</title>
</head>
<body style="font-family: Arial, sans-serif; padding: 20px;">
<h3>SGML Document Structure:</h3>
<pre style="background: #f9f9f9; padding: 15px; border: 1px solid #ddd;"><!DOCTYPE report [
<!ELEMENT report (header, body, footer)>
<!ELEMENT header (title, date)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT body (section+)>
<!ELEMENT section (heading, content)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT content (#PCDATA)>
<!ELEMENT footer (#PCDATA)>
]>
<report>
<header>
<title>Annual Report</title>
<date>2024</date>
</header>
<body>
<section>
<heading>Financial Summary</heading>
<content>Revenue increased by 15%</content>
</section>
</body>
<footer>End of Report</footer>
</report></pre>
<p>SGML uses Document Type Definitions (DTD) to define the structure and rules for documents.</p>
</body>
</html>
Features of SGML
Meta-Language Provides a framework for defining other markup languages.
Platform Independence Documents work across different systems and applications.
Flexible Element Definition Allows custom tags and attributes for specific needs.
Document Validation Ensures documents conform to defined structure rules.
Large Document Management Handles complex document structures efficiently.
Drawbacks of SGML
Complex Syntax Difficult to learn and implement compared to simpler markup languages.
Resource Intensive Requires specialized tools and expertise for development.
Limited Web Support Not directly supported by web browsers like HTML or XHTML.
