Nsgmls Output Format

The output is a series of lines. Lines can be arbitrarily long. Each line consists of an initial command character and one or more arguments. Arguments are separated by a single space, but when a command takes a fixed number of arguments the last argument can contain spaces. There is no space between the command character and the first argument. Arguments can contain the following escape sequences:

\\
A \.
\n
A record end character.
\|
Internal SDATA entities are bracketed by these.
\nnn
The character whose code is nnn octal.

A record start character will be represented by \012. Most applications will need to ignore \012 and translate \n into newline.

\#n;
The character whose number is n decimal in the internal character set. n can have any number of digits. This is used for characters that are not representable by the encoding used for output. This will only occur with the multibyte version of nsgmls.
\%n;
The character whose number is n decimal in the document character set. n can have any number of digits. This is used for data characters resulting from numeric character references to non-SGML characters in fixed character set mode.

The possible command characters and arguments are as follows:

(gi
The start of an element whose generic identifier is gi. Any attributes for this element will have been specified with A commands.
)gi
The end of an element whose generic identifier is gi.
-data
Data.
&name
A reference to an external data entity name; name will have been defined using an E command.
?pi
A processing instruction with data pi.
Aname val
The next element to start has an attribute name with value val which takes one of the following forms:
IMPLIED
The value of the attribute is implied.
CDATA data
The attribute is character data. This is used for attributes whose declared value is CDATA.
NOTATION nname
The attribute is a notation name; nname will have been defined using a N command. This is used for attributes whose declared value is NOTATION.
ENTITY name...
The attribute is a list of general entity names. Each entity name will have been defined using an I, E or S command. This is used for attributes whose declared value is ENTITY or ENTITIES.
TOKEN token...
The attribute is a list of tokens. This is used for attributes whose declared value is anything else.
ID token
The attribute is an ID value. This will be output only if the -oid option is specified. Otherwise TOKEN will be used for ID values.
Dename name val
This is the same as the A command, except that it specifies a data attribute for an external entity named ename. Any D commands will come after the E command that defines the entity to which they apply, but before any & or A commands that reference the entity.
atype name val
The next element to start has a link attribute with link type type, name name, and value val, which takes the same form as with the A command.
Nnname
Define a notation nname. This command will be preceded by a p command if the notation was declared with a public identifier, and by a s command if the notation was declared with a system identifier. If the -onotation-sysid option was specified, this command will also be preceded by an f command giving the system identifier generated by the entity manager (unless it was unable to generate one). A notation will only be defined if it is to be referenced in an E command or in an A command for an attribute with a declared value of NOTATION.
Eename typ nname
Define an external data entity named ename with type typ (CDATA, NDATA or SDATA) and notation not. Thiscommand will be preceded by an f command giving the system identifier generated by the entity manager (unless it was unable to generate one), by a p command if a public identifier was declared for the entity, and by a s command if a system identifier was declared for the entity. not will have been defined using a N command. Data attributes may be specified for the entity using D commands. If the -oentity option is not specified, an external data entity will only be defined if it is to be referenced in a & command or in an A command for an attribute whose declared value is ENTITY or ENTITIES.
Iename typ text
Define an internal data entity named ename with type typ and entity text text. The typ will be CDATA or SDATA unless the -oentity option was specified, in which case it can also be PI or TEXT (for an SGML text entity). If the -oentity option is not specified, an internal data entity will only be defined if it is referenced in an A command for an attribute whose declared value is ENTITY or ENTITIES.
Sename
Define a subdocument entity named ename. This command will be preceded by an f command giving the system identifier generated by the entity manager (unless it was unable to generate one), by a p command if a public identifier was declared for the entity, and by a s command if a system identifier was declared for the entity. If the -oentity option is not specified, a subdocument entity will only be defined if it is referenced in a { command or in an A command for an attribute whose declared value is ENTITY or ENTITIES.
Tename
Define an external SGML text entity named ename. This command will be preceded by an f command giving the system identifier generated by the entity manager (unless it was unable to generate one), by a p command if a public identifier was declared for the entity, and by a s command if a system identifier was declared for the entity. This command will be output only if the -oentity option is specified.
ssysid
This command applies to the next E, S, T or N command and specifies the associated system identifier.
ppubid
This command applies to the next E, S, T or N command and specifies the associated public identifier.
fsysid
This command applies to the next E, S, T or, if the -onotation-sysid option was specified, N command and specifies the system identifier generated by the entity manager from the specified external identifier and other information about the entity or notation.
{ename
The start of the SGML subdocument entity ename; ename will have been defined using a S command.
}ename
The end of the SGML subdocument entity ename.
Llineno file
Llineno
Set the current line number and filename. The file argument will be omitted if only the line number has changed. This will be output only if the -l option has been given.
#text
An APPINFO parameter of text was specified in the SGML declaration. This is not strictly part of the ESIS, but a structure-controlled application is permitted to act on it. No # command will be output if APPINFO NONE was specified. A # command will occur at most once, and may be preceded only by a single L command.
C
This command indicates that the document was a conforming SGML document. If this command is output, it will be the last command. An SGML document is not conforming if it references a subdocument entity that is not conforming.
i
The next element to start is an included subelement. This will be output only if the -oincluded option is specified.
e
The next element to start has a declared content of EMPTY or a content reference attribute, and so its end-tag must be omitted. This will be output only if the -oempty option is specified.

James Clark
jjc@jclark.com