next up previous contents index
Next: 9.3.5 Low-level Parsing Primitives Up: 9.3 Predicate Reference Previous: 9.3.3.1 XML Namespaces   Contents   Index

9.3.4 DTD-Handling

The DTD (Document Type Definition) are internally represented as objects that can be created, freed, defined, and inspected. Like the parser itself, it is filled by opening it as a Prolog output stream and sending data to it. This section summarizes the predicates for handling the DTD.

new_dtd(+DocType, -DTD, -Warn)

Creates an empty DTD for the named DocType. The returned DTD-reference is an opaque term that can be used in the other predicates of this package. Warn is the list of warnings generated.

free_dtd(+DTD, -Warn)

Deallocate all resources associated to the DTD. Further use of DTD is invalid. Warn is the list of warnings generated.

open_dtd(+DTD, +Options, -Warn)

This opens and loads a DTD from a specified location (given in the Options parameter (see next). DTD represents the created DTD object after the source is loaded. Options is a list options. Currently the only option supported is source(location), where location can be of one of these forms:
url(url)
file(fileName)
string('document as a Prolog atom').

dtd(+DocType, -DTD, -Warn)

Certain DTDs are part of the system and have known doctypes. Currently, 'HTML' and 'XHTML' are the only recognized built-in doctypes. Such a DTD can be used for parsing simply by specifying the doctype. Thus, the dtd/3 predicate takes the doctype name, finds the DTD associated with the given doctype, and creates a dtd object for it. Warn is the list of warnings generated.

dtd(+DocType, -DTD, +DtdFile -Warn)

The predicate parses the DTD present at the location DtdFile and creates the corresponding DTD object. DtdFile can have one of the following forms: url(url), file(fileName), string('document as a Prolog atom').


next up previous contents index
Next: 9.3.5 Low-level Parsing Primitives Up: 9.3 Predicate Reference Previous: 9.3.3.1 XML Namespaces   Contents   Index
Terrance Swift 2007-10-06