## 1 Introduction

PSGML is a major mode for editing SGML and XML documents. It works with GNU Emacs 19.34, 20.3 and later or with XEmacs 19.9 and later. PSGML contains a simple SGML parser and can work with any DTD. Functions provided includes menus and commands for inserting tags with only the contextually valid tags, identification of structural errors, editing of attribute values in a separate window with information about types and defaults, and structure based editing.

SGML, a language for encoding the structure of a document, is an ISO standard: ISO 8879:1986 “Information processing – Text and office systems – Standard Generalized Markup Language (SGML)”.

A good introduction to SGML is A Gentle Introduction to SGML produced by Text Encoding Initiative (this is really chapter 2 of TEI P3). This can be found on

    ftp://ftp.ifi.uio.no/pub/SGML/TEI/P3SG.DOC.

A SGML document has three major parts, in order:

1. SGML Declaration (‘`<!SGML "ISO 8879:1986" … >`’)
2. Document Type Declaration (‘`<!DOCTYPE name … >`’)
3. Document Element (‘`<name> … </name>`’)

The SGML declaration contains general information about character sets, concrete syntax, and SGML features used. PSGML does not use the SGML Declaration, it can be left out, and if included is ignored. Many SGML systems allow the SGML declaration to be defaulted. PSGML always use the Concrete Reference Syntax but without limitations on lengths. Features used has to be indicated with variables (see SGML declaration).

The document type declaration specifies the valid elements and entities and how they can be nested. A document type is usually needed, but can reside in another file (see Managing the DTD).

The system declaration for PSGML:

    SYSTEM "ISO 8879:1986"
       CHARSET
         BASESET  "ISO 646-1983//CHARSET
                   International Reference Version (IRV)//ESC 2/5 4/0"
         DESCSET  0 128 0
         CAPACITY PUBLIC  "ISO 8879:1986//CAPACITY Reference//EN"
       FEATURES
         MINIMIZE DATATAG NO  OMITTAG  YES   RANK     NO  SHORTTAG YES
         LINK     SIMPLE  NO  IMPLICIT NO    EXPLICIT NO
         OTHER    CONCUR  NO  SUBDOC   YES 1 FORMAL   YES
         SCOPE    DOCUMENT
         SYNTAX   PUBLIC  "ISO 8879:1986//SYNTAX Reference//EN"
         VALIDATE
                  GENERAL NO  MODEL    NO   EXCLUDE  NO  CAPACITY NO
                  NONSGML NO  SGML     NO   FORMAL   NO
         SDIF     PACK    NO  UNPACK   NO