Open In App

What is SGML ?

Last Updated : 11 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we are going to learn about SGML.SGML stands for Standard generalized markup language is a Standard generalized markup language that makes use of a superset of extensively used markup languages like HTML and XML. It is used for marking up files and has the gain of now no longer depending on a particular application.

It is basically derived from GML (Generalized Markup Language), which allowed users to work on standardized formatting styles for electronic documents. It was developed and standardized by the International Organization for Standards (ISO) in 1986. SGML  specifies the rules for tagging elements. These tags can then be interpreted to layout factors in specific ways.

It is used extensively to manipulate massive files which are a concern with common revisions and want to be published in one-of-a-kind formats due to the fact it’s far a massive and complicated system, it isn’t always but extensively used on private computers.

Components of SGML:

  • SGML provides a way of describing the relationships between these entities, elements, and attributes, and tells the computer how it can recognize the component parts of a document and it is based on the concept of a document being composed of a series of entities (object).
  • It provides rules that allow the computer to recognize where the various elements of a text entity start and end.
  • Document Type Definition (DTD) in SGML is used to describe each element of the document in a form that the computer can understand.

SGML is the simplest medium to produce files that can be read by people and exchanged between machines and applications in a straightforward manner. It is easy to understand by the human as well as the machine.

Structure of SGML:

<mainObject> 
    <subObject>  
    </subObject>
</mainObject> 

The extension of SGML files is: 

File_Name.sgml

Syntax:

<NAME TYPE="user">
   Geeks for Geeks
</NAME> 

Example 1: In this example, we will write code in SGML

SGML




<EMAIL>
    <SENDER>
        <PERSON>
            <FIRSTNAME>GEEKS FOR GEEKS</FIRSTNAME>    
        </PERSON>
    </SENDER>
    <BODY>       
        <p>A Computer Science Portal For Geeks</p>
    </BODY>
</EMAIL>


Output:

simple Paragraph

Example 2: In this example, we will see how to write code in SGML and its element.

SGML




<EMAIL>
    <RECEIVER>
        <PERSON>
            <FIRSTNAME>Krishna</FIRSTNAME>    
        </PERSON>
    </RECEIVER>
    <BODY>       
        <p>It is a name of the person.</p>
 
    </BODY>
</EMAIL>


Output:



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads