Class for checking attributes against declared values.

Checks attribute values against their declared value, if any. Also checks referential integrity constraints (IDREF and #CURRENT values).

Used by Tokenizer, Validator, and Linkhandler.

Configured by the constructor-provided Sgmldecl object.

Handling of WebSGML/Annex K #ALL attributes is such that when enumerating over attributes of a given element, #ALL attributes (those declared on all elements of a document type), if any, are enumerated over after element-specific declared attributes. If the same attribute (name) is declared both on an element directly, and as #ALL attribute, then both attribute declarations will be checked on an invidual attribute specification. The first declaration (specified on the element directly) will establish a value (eg. if it has a #FIXED or default value); the second declaration is processed as if the defaults set by the first, element-specific attribute declaration had been specified in content. As a consequence, if both have a #FIXED declared value, the value literals of both declarations must be the same.

Note #ALL attributes on notations are not supported.

Constructor

new AttributeChecker(sgmldecl, errorhandler, markupdefinitions, entitydefinitions, docinfo, resolver)

Parameters

Name Type Description
sgmldecl Sgmldecl
errorhandler Errorhandler
markupdefinitions Markupdefinitions
entitydefinitions Entitydefinitions
docinfo Docinfo
resolver SystemSpecificEntityResolver

only provided for determining whether being called from within a literal template being executed as separate subprocess as workaround for outdated nawk on Mac OS

Name Description
check_attribute_array Checks, and populates with default attribute values if appropriate, the supplied attribute array for an element or notation.
configure Configuration method.
set_declaration_set_name Sets default declaration set name to use for lookup of attribute metadata in calls to check_attribute_value(), if none was supplied on the call itself.

Member Details

check_attribute_array(doctype, elementtype, notationname, content_msg)

Checks, and populates with default attribute values if appropriate, the supplied attribute array for an element or notation.

Will call errorhandler.error() (recoverable error) if anything is wrong with attributes.

Parameters

Name Type Description
doctype string

declaration set name to lookup attribute metadata in; if this is empty, the configured default declaration set name will be used

elementtype string

element name on which the attributes occur

notationname string

notation name having the (data) attributes (if this is non-empty, elementtype is ignored)

content_msg string

string to prepend before an error message

configure(args)

Configuration method.

Parameters

Name Type Description
args Object.<string, string>

Map of configuration properties

set_declaration_set_name(name)

Sets default declaration set name to use for lookup of attribute metadata in calls to check_attribute_value(), if none was supplied on the call itself.

This can be configured only once; subsequent calls are ignored.

Parameters

Name Type Description
name string

declaration set name to set