class dtd :?swarner:Pxp_core_types.I.symbolic_warnings -> Pxp_core_types.I.collect_warnings -> Pxp_core_types.I.rep_encoding ->object..end
Pxp_dtd.create_dtd.
Despite its name, this object does not only define the DTD as such (i.e. what would be found in a ".dtd" file), but all formal requirements of documents that are needed by PXP. This also includes:
For some introductory words about well-formedness mode, see
Parsing in well-formedness mode.
method root : string optionmethod set_root : string -> unitmethod id : Pxp_core_types.I.dtd_id optionNone: There is no DOCTYPE declaration, or only
<!DOCTYPE name>Some Internal: There is a DOCTYPE declaration with material
in brackets like <!DOCTYPE name [ declarations ... ]> Some(External xid): There is a DOCTYPE declaration with
a SYSTEM or PUBLIC identifier (described by xid), but without
brackets, i.e. <!DOCTYPE name SYSTEM '...'> or
<!DOCTYPE name PUBLIC '...' '...'> .Some(Derived xid): There is a DOCTYPE declaration with
a SYSTEM or PUBLIC identifier (described by xid), and with
bracketsmethod set_id : Pxp_core_types.I.dtd_id -> unitmethod encoding : Pxp_core_types.I.rep_encodingmethod lexer_factory : Pxp_lexer_types.lexer_factorymethod allow_arbitrary : unitarbitrary_allowed flag. This flag disables
a specific validation constraint, namely that all elements
need to be declared in the DTD. This feature is used
to implement the well-formedness mode: In this mode, the element,
attribute, and notation declarations found in the textual DTD are ignored, and not
added to this DTD object. As the arbitrary_allowed flag is also
set, the net effect is that all validation checks regarding
the values of elements and attributes are omitted. The flag is
automatically set if the parser is called using one of the
"wf" functions, e.g. Pxp_tree_parser.parse_wfdocument_entity.
Technically, the arbitrary_allowed flag changes the behaviour of
the element and notation methods defined below so that they
raise Undeclared instead of Validation_error when an unknown
element or notation name is encountered.
method disallow_arbitrary : unitarbitrary_allowed flag againmethod arbitrary_allowed : boolmethod standalone_declaration : boolmethod set_standalone_declaration : bool -> unitmethod namespace_manager : namespace_managerNot_found is raised.method set_namespace_manager : namespace_manager -> unitnamespace_manager.method add_element : dtd_element -> unitNot_found
if there is already an element declaration with the same name.method add_gen_entity : Pxp_entity.entity -> bool -> unitadd_gen_entity e extdecl:
add the entity e as general entity to this DTD (general entities
are those represented by &name;). If there is already a declaration
with the same name, the second definition is ignored; as exception from
this rule, entities with names "lt", "gt", "amp", "quot", and "apos"
may only be redeclared with a definition that is equivalent to the
standard definition; otherwise a Validation_error is raised.
extdecl: true indicates that the entity declaration occurs in
an external entity. (Used for the standalone check.)
method add_par_entity : Pxp_entity.entity -> unitmethod add_notation : dtd_notation -> unitValidation_error is raised.method add_pinstr : proc_instruction -> unitmethod element : string -> dtd_elementValidation_error if the element cannot be found. If the
arbitrary_allowed flag is set, however,
Undeclared is raised instead.method element_names : string listmethod gen_entity : string -> Pxp_entity.entity * boollet e, extdecl = obj # gen_entity n:
looks up the general entity e with the name n. Raises
WF_error if the entity cannot be found.
extdecl: indicates whether the entity declaration occured in an
external entity.
method gen_entity_names : string listmethod par_entity : string -> Pxp_entity.entityWF_error if the entity cannot be found.method par_entity_names : string listmethod notation : string -> dtd_notationValidation_error if the notation cannot be found. If the
arbitrary_allowed flag is sez, however,
Undeclared is raised instead.method notation_names : string listmethod pinstr : string -> proc_instruction list<?.method pinstr_names : string listmethod validate : unitValidation_error is raised,
but other exceptions are possible, too.method only_deterministic_models : unitValidation_error.method write : ?root:string ->
Pxp_core_types.I.output_stream -> Pxp_core_types.I.encoding -> bool -> unitwrite os enc doctype:
Writes the DTD as enc-encoded string to os. If doctype, a
DTD like <!DOCTYPE root [ ... ]> is written. If not doctype,
only the declarations are written (the material within the
square brackets).
The entity definitions are not written. However, it is ensured that the generated string does not contain any reference to an entity. The reason for the omission of the entites is that there is no generic way of writing references to external entities.
Option root: Override the name of the root element in the
DOCTYPE clause.
method write_ref : ?root:string ->
Pxp_core_types.I.output_stream -> Pxp_core_types.I.encoding -> unitwrite_ref os enc:
Writes a reference to the DTD as enc-encoded string to os.
The reference looks as follows:
<!DOCTYPE root SYSTEM ... > or
<!DOCTYPE root PUBLIC ... >
Of course, the DTD must have an external ID:write_ref will fail.
If the ID is anonymous or private, the method will fail, too.
Option root: Override the name of the root element in the
DOCTYPE clause.