[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PSGML needs to know about the DTD you are using for many of its commands. If you do not have a `DOCTYPE' declaration in your file, PSGML will try assume that there is one of the form
<!DOCTYPE name SYSTEM> |
where name is the value of sgml-default-doctype-name
, if
the value is non-nil
, else the GI of the first tag will be used.
PSGML will try to parse the document type declaration the first time
you do something that needs to parse the document or immediately if the
variable sgml-auto-activate-dtd
is t
. You can also
initiate the parsing of the document type declaration with the command
sgml-parse-prolog
. Big DTDs take some time to parse.
When the DTD has been parsed or loaded the name of the document element will be displayed in the mode line inside brackets. If there was an error parsing the DTD or there is no DTD, the mode line will display `[ANY]' (*** this is not really correct! a DTD will be established even if there are missing entities, it may even be empty).
7.1 Precompiled DTD Subsets | ||
7.2 Using a Split Document | ||
7.3 Inserting a DOCTYPE | ||
7.4 Information from the DTD | ||
7.5 Customizing DTD |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If parsing the DTD takes too long time you can arrange to have PSGML cache an internal complied version of the DTD. Caching can be done of DTD fragments in favourable situations. It is possible to have an external DTD subset cached but still have an internal DTD subset as long as the internal subset does not define parameter entities that affect the parsing of the external subset (*** what is the exact conditions?, probably you can't use the cached external subset if the internal subset defines parameter entities that are also defined in the external subset with another value).
To enable caching you have to create special catalog files, hereafter
called ECAT files due to (temporary) lack of imagination. These catalogs
have similar syntax to the entity catalogs and there are two variables
containing lists of catalogs to search: sgml-ecat-files
and
sgml-local-ecat-files
. The ECAT files can contain the following
types of entries:
[ name1 literal1 name2 literal2 ... ] |
nil
, out of date compiled DTDs will be automatically
recompiled. If the value is ask
, PSGML will ask before
recompiling. A nil
value will cause PSGML to silently load an out
of date compiled DTD. A DTD that refers to undefined external entities
is always out of date, thus in such case it can be useful to set this
variable to nil
.
Previous versions of PSGML have had another way of speeding up DTD parsing. This code remains in this version of PSGML, but is not actively maintained and may disappear in the future.
You can save the parsed DTD in a file using the command M-x sgml-save-dtd. Next time PSGML can load that file instead of parsing the DTD. For PSGML to find the saved DTD you must either save the DTD using the default name or do a M-x sgml-save-options after saving the DTD. To directly use an already parsed and saved DTD, load the file containing the saved DTD with the command M-x sgml-load-dtd.
sgml-mode
to the buffer file name less extension plus the
extension .ced
, if that file exists. Can be changed in the Local
variables section of the file.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You can have the `DOCTYPE' declaration in another file by setting
sgml-doctype
to the other file.
The variable describes how the current file's content fit into the element hierarchy. The variable should have the form
(parent-file context-element* top-element (has-seen-element*)?) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
*** Describe the DTD menu in general. Describe customized entries for special DTDs. Mention C-c C-u C-d for inserting a DOCTYPE from keyboard.
If you change the doctype you must execute sgml-parse-prolog
,
changes in the doctype are not automatically recognized.
Every entry should be a list. The first element of the entry is a string
used as the menu entry. The second element is a string containing a
doctype declaration (this can be nil if no doctype). The rest of the
list should be a list of variables and values. For backward
compatibility a single string instead of a variable is assigned to
sgml-default-dtd-file
. All variables are made buffer local and
are also added to the buffers local variables list.
When an entry is selected from the DTD menu, the doctype declaration will be inserted, the variables will be set to the values in the entry and a local variables list will be created in the buffer.
Example:
(("HTML" nil sgml-default-dtd-file "~/sgml/html.ced" sgml-omittag nil sgml-shorttag nil) ("HTML+" "<!doctype htmlplus system 'htmlplus.dtd'>" "~/sgml/htmlplus.ced" sgml-omittag t sgml-shorttag nil) ("DOCBOOK" "<!doctype docbook system 'docbook.dtd'>" "~/sgml/docbook.ced" sgml-omittag nil sgml-shorttag t))) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PSGML can list various information about the current DTD. The following commands can be used via M-x and can also be found in the DTD menu.
sgml-describe-dtd
sgml-describe-element-type
sgml-describe-entity
sgml-list-elements
sgml-list-attributes
sgml-list-terminals
sgml-list-occur-in-elements
sgml-list-content-elements
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PSGML can be customized by process instructions starting with "PSGML"
in the DTD. Generally this associates some information with element
types. E.g., if sgml-fill-element
should skip the element type
or if the content should be displayed with a special font.
The general syntax is
`<?PSGML ELEMENT' gi (prop = value)* `>' |
Note: in XML the ending delimiter is `?>', in SGML mode a trailing `?' will be ignored if preceded by a space.
Where gi is the element type, prop is a propery described below, and value is the value for the property. The first part from `PSGML' to gi is read with current setting for `NAMECASE GENERAL', i.e., case insensitive for normal SGML but case sensitive in XML mode. The prop and value is read using Emacs Lisp conventions, i.e. case sensitive and value is a lisp expression (not evaluated).
Example
<?PSGML ELEMENT PRE nofill=t face=fixed-pitch> |
Properties
nofill
t
or nil
. If t
the elements of this
type will be ignored when filling with sgml-fill-element
.
Note that Emacs normal filling functions will not honor this.
font
bold
, italic
, fixed-pitch
. The
content of elements of this type will be displayed in that face.
attnames
attnames=("ID" "CLASS"
"ONCLICK")
. This controls the attributes included when using the
sgml-edit-attributes
(C-c C-a) command. Only the
attributes in the list will be included and in that order. You can
also end the list with a *
to include all attributes, but the
listed attributes will be on the top. E.g.,
attnames=("ID" "CLASS" "ONCLICK" *)
.
Note: that the attribute names need to be written with the correct
case and in string quotes.
structure
sgml-show-structure
(C-c
C-s). If set to t
, the element is included and if set to
ignore
it will not be included. See section Showing information.
help-text
sgml-show-current-element-type
(C-c C-t).
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by XEmacs shared group account on December, 19 2009
using texi2html 1.65.