Parserinfo last_opened_info()

- return information about last opened element

int group_add_list(list, val)

- add value to list P_Group list; String val;

Bool also_in_idref(name)

- check if name is in idref-list String name;

An empty endtag belongs to the most recently open element. Information about the last opened element is obtained by last_open_info().

Every ID-attribute must at least be referenced by one IDREF-attribute and must be unique. Also every IDREF-attribute must refer to a declared ID-attribute. All the values of ID-attributes are stored in one group. Also all the value of the IDREF-attributes are stored (uniquely) in another group (one ID can be referenced more than once). group_add_list() stores all the IDREFS of one IDREFS-attribute in list and returns the number of IDREFS stored.

also_in_idref() checks whether the given name is in the idref-list, if so the name is deleted and TRUE is returned, otherwise FALSE is returned.

void check_starttag(info)

- check a starttag Parserinfo info;

check_starttag() checks whether the attributes fulfill requirements specified in the document type definition. Every REQUIRED attribute must be given a value. For every FIXED attribute the given value must be the same as the default value. If the attribute is a CURRENT attribute, the first time the starttag is used, the value must be given. If the value for the attribute is not given the previous given value is used as the default value. In check_starttag() is also checked whether the ID-value is a unique value. The ID-values are added to the id-list and the IDREF and IDREFS-values are added uniquely to the idref-list. Also the number of ID's and IDREFS are counted for the capacity points.

void pars_empty(starttag)

- generate starttag for empty content int starttag;

void pars_conref(starttag)

- handle conref attributes int starttag;

void pars_start(starttag)

- generate a starttag int starttag;

void pars_end(endtag)

- generate an endtag int endtag;

void pars_document()

- handle end document

To parse a document correctly information must be maintained about the open elements, the possible inclusions, the exclusions and the shortreference maps used. In pars_start() the opened element is pushed on the stack and the inclusions and exclusions activated by this element are also pushed on a stack. The associated map, if there is any, becomes the current map. The starttag is also generated.

In pars_end() the reverse is done, the now closed element is popped of the stack of open elements, the inclusions and exclusions associated with this element are popped of the stack. And the previous map (the one active before this map) becomes active again. The endtag is generated.

If an elements content is declared EMPTY, the pushing of the element on the open elements stack is not necessary because the element has no endtag. It consist solely of a starttag. pars_empty() only generates the starttag with the attributes and returns.

If an element has a CONREF-attribute the element has empty contents, if the attribute is given, and the content according to the element's declaration otherwise. Skipping the content of such an element is achieved by inputing a new defined token TOK_CONREF in the inputstream. .sp 0 The rule in LLgen for the element is: .sp .ce 1 A : [STARTTAG_A {pars_conref(STARTTAG_A); } [A | TOK_CONREF] ; .sp

pars_document() is called at the end of the document to check the id-values and the idref-values.

startend.c startend.h