Open In App

SGML vs. XML

SGML, created in 1969 and defined by ISO in 1986, is a key development in the representation of structured data. It opened the way for more modern languages like XML, which only started to gain popularity in 1996 and was given W3C recommendation status in 1998. While SGML provided the foundation, XML added advances addressing contemporary data storage and exchange demands. The comparison that follows will examine these two markup languages’ finer points and provide an understanding of their distinctive advantages and disadvantages.

Standard Generalized Markup Language (SGML):

Example:






<EMAIL>
    <RECEIVER>
        <PERSON>
            <FIRSTNAME>GeeksForGeeks</FIRSTNAME>
        </PERSON>
    </RECEIVER>
 
    <BODY>
        <h1>The Learning Portal.</h1>
        <p>
              This is a sample paragraph for
              demonstrating SGML Example.
          </p>
    </BODY>
</EMAIL>

Output:

SGML Example Output

Extensible Markup Language (XML):

Example:






<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html>
<to>To: All Learners</to><br>
<from>From: GeeksForGeeks</from><br>
<heading>Reminder</heading>
 
<body>
    <p>Don't forget to follow:</p>
    <h1>GeeksForGeeks</h1>
    <p>A Computer Science Portal For Geeks</p>
</body>
 
</html>

Output:

XML Example Output

SGML vs. XML

SGML

XML

Standard Generalized Markup Language (SGML)

Extensible Markup Language (XML) 

Created in 1980s

Created in 1990s

Used for data exchange and storage

Used for representing structured information

More complex and flexible markup language.

Simplified and more specific.

It allows high degree of customization

It is more specific in nature.

Allows creatiion of new tags

It has predefined rules for tags and elements.

Used in various industries like publishing, aerospace, and document management.

Used in web for representing and exchanging structured data.

Conclusion: Although both SGML and XML are useful tools for structuring and organizing data, their functions and traits are different. Modern applications favor using XML over SGML for data exchange and storage because it is more organized and standardized whereas SGML is more extendable and flexible. When deciding which of the two markup languages to use for certain projects or applications, it is crucial to comprehend these distinctions.


Article Tags :