Class Pxp_dtd.dtd_element


class dtd_element : dtd -> string -> object .. end

Creation: new dtd_element init_dtd init_name: 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
returns the name of the declared element
method externally_declared : bool
returns whether the element declaration occurs in an external entity.
method content_model : Pxp_core_types.content_model_type
get the content model of this element declaration, or Unspecified
method content_dfa : Pxp_dfa.dfa_definition option
return the DFA of the content model if there is a DFA, or None. A DFA exists only for regexp style content models which are deterministic.
method set_cm_and_extdecl : Pxp_core_types.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.rep_encoding
Return the encoding of the strings
method allow_arbitrary : unit
After this method has been invoked, the object changes its behaviour:
method disallow_arbitrary : unit
method arbitrary_allowed : bool
Returns whether arbitrary attributes are allowed or not.
method attribute : string -> Pxp_core_types.att_type * Pxp_core_types.att_default
get the type and default value of a declared attribute, or raise Validation_error if the attribute does not exist. If 'arbitrary_allowed', 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: The method raises Validation_error if the attribute does not exist. If 'arbitrary_allowed', the exception Undeclared is raised instead of Validation_error.
method attribute_names : string list
get the list of all declared attributes
method names_of_required_attributes : string list
get the list of all attributes that are specified as required attributes
method id_attribute_name : string option
Returns the name of the attribute with type ID, or None.
method idref_attribute_names : string list
Returns the names of the attributes with type IDREF or IDREFS.
method add_attribute : string ->
Pxp_core_types.att_type -> Pxp_core_types.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
checks whether this element declaration (i.e. the content model and all attribute declarations) is valid for the associated DTD. Raises mostly Validation_error if the validation fails.
method write : Pxp_core_types.output_stream -> Pxp_core_types.encoding -> unit
write os enc: Writes the <!ELEMENT ... > declaration to 'os' as 'enc'-encoded string.
method internal_vr : validation_record
INTERNAL METHOD: Returns the validation record for this element type.