class XML_DTD_VALIDATOR
Summary
Helps the parser to validate an XML file using a DTD
Direct parents
Inherit list: BACKTRACKING, XML_VALIDATOR
Insert list: RECYCLABLE, XML_DTD_MEMORY
Class invariant
Overview
Creation features
{XML_DTD_MEMORY}
Features
{XML_PARSER}
Nodes management, for validation
{}
Attributes string management
{}
{XML_DTD_PARSER}
<!ELEMENT . . .>
{XML_DTD_PARSER}
{}
<!ATTLIST . . .>
{XML_DTD_PARSER}
<!ENTITY . . .>
{XML_DTD_PARSER}
{XML_DTD_ELEMENT}
{XML_DTD_ELEMENT}
{XML_DTD_PCDATA_NODE}
{XML_DTD_ANY_NODE}
{XML_DTD_EMPTY_NODE}
{XML_DTD_END_NODE}
Backtracking internals
{}
{XML_DTD_MEMORY}
{RECYCLING_POOL}
  • recycle
    Do whatever needs to be done to free resources or recycle other objects when recycling this one
{}
{ANY}
internal
{}
Common client features
{ANY}
Control of the exploration
{ANY}
Internal
{}
Specific to sequences
{ABSTRACT_BACKTRACKING_SEQUENCE}
Specific to alternatives
{ABSTRACT_BACKTRACKING_ALTERNATIVE}
internal: allocation and collection
{}
{ANY}
the pools
{ANY}
Memory management
{}
writable attribute
writable attribute
point: XML_DTD_NODE
writable attribute
with_attribute (attribute_name: UNICODE_STRING, attribute_value: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
Called by the parser to add an attribute of a node BEFORE calling open_node
require
  • not attribute_name.is_empty
  • not attribute_value.is_empty
is_valid_open_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32): BOOLEAN
effective function
When the parser reads an opening node
require
  • not node_name.is_empty
is_valid_close_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32): BOOLEAN
effective function
When the parser reads a closing node
require
  • not node_name.is_empty
  • current_node.is_equal(node_name)
is_valid_open_close_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32): BOOLEAN
effective function
When the parser reads a node that opens and closes immediately (syntax "<node/>")
require
  • not node_name.is_empty
current_node: UNICODE_STRING
effective function
The current node
open_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
When the parser reads an opening node
require
  • is_valid_open_node(node_name, line, column)
ensure
  • current_node.is_equal(node_name)
close_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
When the parser reads a closing node
require
  • is_valid_close_node(node_name, line, column)
open_close_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
When the parser reads a node that opens and closes immediately (syntax "<node/>")
require
  • is_valid_open_close_node(node_name, line, column)
entity (a_entity: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32): UNICODE_STRING
effective function
When the parser reads an &entity;'.
entity_url (a_entity: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32): UNICODE_STRING
effective function
When the parser reads an &entity;'.
Returns the entity URL if it is a SYSTEM entity.
is_valid_data (a_data: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32): BOOLEAN
effective function
Called by the parser when the node contains raw data
require
  • not a_data.is_empty
data (a_data: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
Called by the parser when the node contains raw data
require
  • not a_data.is_empty
the_end
effective procedure
Called when the xml is totally parsed; usually it is used to recycle memory resources
once function
{}
new_node (element: XML_DTD_ELEMENT, parent: XML_DTD_NODE): XML_DTD_NODE
effective function
{}
ensure
  • Result.is_empty
  • Result.element = element
  • Result.parent = parent
free_node (a_node: XML_DTD_NODE)
effective procedure
{}
clear_attributes
effective procedure
{}
parse_done
effective procedure
Called when done parsing the DTD
current_element: XML_DTD_ELEMENT
writable attribute
element_built (element_name: UNICODE_STRING): BOOLEAN
effective function
adding_element (element_name: UNICODE_STRING): BOOLEAN
effective function
ensure
building_element: BOOLEAN
effective function
add_element (element_name: UNICODE_STRING)
effective procedure
require ensure
commit_element (element_name: UNICODE_STRING)
effective procedure
require ensure
close_fix
effective procedure
close_exactly_one
effective procedure
close_zero_or_one
effective procedure
close_zero_or_more
effective procedure
close_one_or_more
effective procedure
add_list
effective procedure
add_alt
effective procedure
child_pcdata
effective procedure
child_any
effective procedure
child_empty
effective procedure
child_one_or_more (node: UNICODE_STRING)
effective procedure
child_zero_or_more (node: UNICODE_STRING)
effective procedure
child_zero_or_one (node: UNICODE_STRING)
effective procedure
child_exactly_one (node: UNICODE_STRING)
effective procedure
root_element: XML_DTD_ELEMENT
effective function
{}
get_element (element_name: UNICODE_STRING): XML_DTD_ELEMENT
effective function
{}
ensure
  • Result.name.is_equal(element_name)
once function
{}
attlist_element: XML_DTD_ELEMENT
writable attribute
building_attlist: BOOLEAN
effective function
has_attlist (element_name: UNICODE_STRING, attribute_name: UNICODE_STRING): BOOLEAN
effective function
ensure
adding_attlist (element_name: UNICODE_STRING, attribute_name: UNICODE_STRING): BOOLEAN
effective function
ensure
add_attlist (element_name: UNICODE_STRING, attribute_name: UNICODE_STRING)
effective procedure
require ensure
commit_attlist (element_name: UNICODE_STRING, attribute_name: UNICODE_STRING)
effective procedure
require ensure
addlist_list_value (value: UNICODE_STRING)
effective procedure
attlist_cdata
effective procedure
attlist_id
effective procedure
attlist_idref
effective procedure
attlist_idrefs
effective procedure
attlist_nmtoken
effective procedure
attlist_nmtokens
effective procedure
attlist_entity
effective procedure
attlist_entities
effective procedure
attlist_notation
effective procedure
attlist_required
effective procedure
attlist_implied
effective procedure
attlist_valid_fixed (value: UNICODE_STRING): BOOLEAN
effective function
attlist_fixed (value: UNICODE_STRING)
effective procedure
attlist_default_value (value: UNICODE_STRING)
effective procedure
has_entity (entity_name: UNICODE_STRING): BOOLEAN
effective function
add_entity (entity_name: UNICODE_STRING, entity_value: UNICODE_STRING, entity__url: UNICODE_STRING)
effective procedure
require ensure
backtrack_valid_data (a_children: FAST_ARRAY[XML_DTD_NODE], a_node: BACKTRACKING_NODE, a_data: UNICODE_STRING): BOOLEAN
effective function
require
  • a_node /= Void
backtrack_is_valid (a_children: FAST_ARRAY[XML_DTD_NODE], a_node: BACKTRACKING_NODE, a_next: UNICODE_STRING): BOOLEAN
effective function
require
  • a_node /= Void

backtrack_valid_child (elt: XML_DTD_ELEMENT)
effective procedure
require
  • elt /= Void
backtrack_valid_pcdata
effective procedure
backtrack_valid_any
effective procedure
backtrack_valid_empty
effective procedure
backtrack_valid_end
effective procedure
backtrack_pcdata: UNICODE_STRING
writable attribute
{}
backtrack_children: FAST_ARRAY[XML_DTD_NODE]
writable attribute
{}
backtrack_index: INTEGER_32
writable attribute
{}
backtrack_ok: BOOLEAN
writable attribute
{}
backtrack_next: UNICODE_STRING
writable attribute
{}
writable attribute
{}
context_clear
effective procedure
{}
Clear any saved context.
Called by the features clear and search_first.
context_push
effective procedure
{}
Push the current context.
Called each time that an alternative begins.
context_restore
effective procedure
{}
Restore the context to the last saved one.
The saved context MUST remain available for future use. Called each time that a new alternative (of the previous alternative point) is starting.
context_restore_and_pop
effective procedure
{}
Restore the context to the last saved one and drop it.
The saved context MUST be removed. Called each time that the last alternative (of the previous alternative point) is starting. Should be similar to context_restore followed by context_cut.
context_cut
effective procedure
{}
Remove the last saved context.
Called by cut, cut_all or cut_until.
root_name: UNICODE_STRING
writable attribute
make (root_node_name: UNICODE_STRING)
effective procedure
require
  • not root_node_name.is_empty
ensure
recycle
effective procedure
Do whatever needs to be done to free resources or recycle other objects when recycling this one
recycle_elements
effective procedure
{}
ensure
recycle_entity_urls
effective procedure
{}
ensure
backtrack_next_pcdata_marker: UNICODE_STRING
once function
{}
set_current_node (node: BACKTRACKING_NODE)
effective procedure
{ANY}
Sets the next node of the BACKTRACKING_NODE graph to evaluate.
ensure
push_and (node: BACKTRACKING_NODE)
effective procedure
{ANY}
Pushes node in front of the continuation path.
require
  • node_not_void: node /= Void
push_and_list (list: BACKTRACKING_NODE_AND_LIST)
effective procedure
{ANY}
Pushes list in front of the continuation path.
require
  • list_not_void: list /= Void
push_or (node: BACKTRACKING_NODE)
effective procedure
{ANY}
Pushes node in front of the possible alternatives.
require
  • node_not_void: node /= Void
push_or_list (list: BACKTRACKING_NODE_OR_LIST)
effective procedure
{ANY}
Pushes list in front of the possible alternatives.
require
  • list_not_void: list /= Void
evaluate_current_state
effective procedure
{}
That feature is called to evaluate the current state
search_first
effective procedure
{ANY}
Resets all and searches the first solution.
The current state must be set. It is the first state, the root of the search. When the feature returns, 'search_is_success' must be checked to know if a solution was found. When search_is_success=False, it means that there is no solution at all. Conversely, if search_is_success=True, then the first solution is found and 'search_next' can be called to get the next solution if it exists.
ensure
search_next
effective procedure
{ANY}
Searches the next solution.
When the feature returns, 'search_is_success' must be checked to know if a solution was found. When search_is_success=False at the end, it means that there is no more solution. Conversely, if search_is_success=True, then a solution is found and 'search_next' can be called again to get the next solution.
require ensure
search_is_success: BOOLEAN
writable attribute
{ANY}
True when search is successful
is_off: BOOLEAN
effective function
{ANY}
True when search is finished
ensure
clear
effective procedure
{ANY}
Clears the current state to nothing.
ensure
is_cleared: BOOLEAN
effective function
{ANY}
True if no partial data remain in the current state
ensure
  • no_solution_when_cleared: Result implies is_off
push_sequence (sequence: ABSTRACT_BACKTRACKING_SEQUENCE)
effective procedure
{ANY}
Pushes the sequence in front of the continuation path.
require
  • sequence_not_void: sequence /= Void
ensure
push_alternative (alternative: ABSTRACT_BACKTRACKING_ALTERNATIVE)
effective procedure
{ANY}
Pushes the alternative before the continuation path.
require
  • alternative_not_void: alternative /= Void
ensure
continue
effective procedure
{ANY}
Continues the exploration of the current path.
backtrack
effective procedure
{ANY}
Stops the exploration of the current path and tries to explore the next alternative path.
push_cut_point
effective procedure
{ANY}
Inserts a cut point into the continuation path.
The inserted cut point records the current top of the alternatives.
cut
effective procedure
{ANY}
Removes the alternatives until the one recorded by the next cut point in the continuation path.
cut_all
effective procedure
{ANY}
Cuts all alternatives.
stop_search_loop: BOOLEAN
writable attribute
{}
True if at the end of a search.
This occurs if either a solution is found (and then search_is_success=True) or no solution is found (and then search_is_success=False). That feature should be modified only by continue and backtrack.
search
effective procedure
{}
Common search loop to search_first and search_next
cut_until (alternative: ABSTRACT_BACKTRACKING_ALTERNATIVE)
effective procedure
{}
Cut all alternatives until 'alternative'.
To cut an alternative is currently to remove it.
ensure
Stack of sequences represented by its top (can be Void)
current_continuation: ABSTRACT_BACKTRACKING_SEQUENCE
writable attribute
The current continuation path
pop_sequence
effective procedure
Removes the current sequence and replace it by the next sequence in the continuation path.
require
Stack of alternatives represented by its top (can be Void)
continue_alternative
effective procedure
Returns to the alternative on the top of the stack and put its saved continuation path as the current continuation path.
require ensure
pop_alternative
effective procedure
Returns to the alternative on the top of the stack and put its saved continuation path as the current continuation path.
Remove the alternative from the stack of alternatives. Same as continue_alternative but also removes the alternative.
require ensure
remove_top_sequence
effective procedure
{}
Removes the top sequence.
require ensure
remove_top_alternative
effective procedure
{}
Removes the top alternative.
require ensure
once function
{ANY}
Bank of cut points
once function
{ANY}
pool_of_sequence_list: BACKTRACKING_POOL_OF_SEQUENCE_LIST
once function
{ANY}
pool_of_alternative: BACKTRACKING_POOL_OF_ALTERNATIVE
once function
{ANY}
pool_of_alternative_list: BACKTRACKING_POOL_OF_ALTERNATIVE_LIST
once function
{ANY}
dtd_validators_pool: RECYCLING_POOL[XML_DTD_VALIDATOR]
effective function
{}
new_dtd_validator (root_node_name: UNICODE_STRING): XML_DTD_VALIDATOR
effective function
{}
ensure
  • Result /= Void
  • Result.root_name = root_node_name
recycle_dtd_validator (a_validator: XML_DTD_VALIDATOR)
effective procedure
{}
once function
{}
new_empty_string: UNICODE_STRING
effective function
{}
ensure
  • Result /= Void
new_string (s: UNICODE_STRING): UNICODE_STRING
effective function
{}
require
  • s /= Void
ensure
  • Result.is_equal(s)
free_string (a_string: UNICODE_STRING)
effective procedure
{}
require
  • a_string /= Void
url_pool: RECYCLING_POOL[URL]
once function
{}
once function
{}