class dtd_element :A single element declaration that can be added to the DTD object. Element declarations are created bydtd -> string ->
object
..end
new dtd_element init_dtd init_name
This creates a new dtd_element
object for init_dtd
with init_name
.
The strings are represented in the same encoding as init_dtd
.method name : string
method externally_declared : bool
method content_model : Pxp_core_types.I.content_model_type
Unspecified
method content_dfa : Pxp_dfa.dfa_definition option
None
.
A DFA exists only for regexp style content models which are
deterministic.method set_cm_and_extdecl : Pxp_core_types.I.content_model_type -> bool -> unit
set_cm_and_extdecl cm extdecl
:
set the content model to cm
. Once the content model is not
Unspecified
, it cannot be set to a different value again.
Furthermore, it is set whether the element occurs in an external
entity (extdecl
).method encoding : Pxp_core_types.I.rep_encoding
method allow_arbitrary : unit
arbitrary_allowed
flag for this element.
The effect of this flag is to ignore the validation constraint
that attributes for this element needs to be declared. Note that
this mode is not required for implementing the well-formedness
mode, because for this it is already sufficient to set the
same-named flag in the global DTD object. Setting this flag for
certain elements may still be useful, however. It is then possible
to allow arbitrary attributes for certain elements only.
Technically, the arbitrary_allowed
flag changes the behaviour of
the attribute
method defined below so that it
raises Undeclared
instead of Validation_error
when an unknown
attribute name is encountered.
method disallow_arbitrary : unit
arbitrary_allowed
flagmethod arbitrary_allowed : bool
method attribute : string -> Pxp_core_types.I.att_type * Pxp_core_types.I.att_default
Validation_error
if the attribute does not exist.
If the arbitrary_allowed
flag is set, the exception Undeclared
is raised instead of Validation_error
.method attribute_violates_standalone_declaration : string -> string option -> bool
attribute_violates_standalone_declaration name v
:
Checks whether the attribute name
violates the standalone
declaration if it has value v
.
The method returns true if:v = None
, and there is a default for the attribute valuev = Some s
, and the type of the attribute is not CDATA,
and s
changes if normalized according to the rules of the
attribute type.Validation_error
if the attribute does not exist.
If the arbitrary_allowed
flag is set, the exception Undeclared
is raised instead of Validation_error
.method attribute_names : string list
method names_of_required_attributes : string list
method id_attribute_name : string option
None
.method idref_attribute_names : string list
method add_attribute : string ->
Pxp_core_types.I.att_type -> Pxp_core_types.I.att_default -> bool -> unit
add_attribute name type default extdecl
:
add an attribute declaration for an attribute with the given name,
type, and default value. If there is more than one declaration for
an attribute name, the first declaration counts; the other declarations
are ignored.
extdecl
: if true, the attribute declaration occurs in an external
entity. This property is used to check the "standalone" attribute.
method validate : unit
Validation_error
if the validation fails.