This function calculates the status for each node in the tree, of which node is the root. This status can be one of {UNDEFINED, INHERENTLY_OPT, ALWAYS_REQUIRED, CONTEXT_REQUIRED}. This status is used for determining whether a starttag may be omitted or not. A starttag may possibly be omitted only if the status is one of {ALWAYS_REQUIRED, CONTEXT_REQUIRED}. See Standard 7.3.1.1, page 22 and the definitions in chapter 4.
The function inherently_optional() recursively traverses the tree of which node is the root. It returns TRUE when node is inherently optional and the status is set to INHERENT_OPT, otherwise FALSE is returned and the status is set to UNDEFINED.
The function contextual_required() determines whether the given node is ALWAYS_REQUIRED or CONTEXT_REQUIRED. It stores this value in each node. node must be a SEQ-group, because a token can only be contextually required in such a group (see Standard 4.62, page 8).
For a node, whose status is optional nor required, its status is set to UNDEFINED.
Traverse the tree from which node is the root , calling contextual_required() for every SEQ group.