This Page


Defines classes for parsing attribute lists, which are comma-separated key/value pairs, with values in double quotes and preceded by the equals sign:

<name>="<value>", <name>="<value>", ..., <name>="<value>"
class AttributeListSyntax(attributes)[source]

Represents the abstract syntax of an attribute list, consisting of a collection of named attributes with associated values. Implements container semantics (via in and []) to allow easy access to these key-value mappings.


Initializes a new attribute list syntax object with the given dictionary of attribute-name-to-attribute-value mappings.


Allows the use of the in keyword to determine whether an attribute with the given name is present in the list.


Allows the use of square-bracket notation to retrieve the value associated with a specified attribute.


Converts the syntax object back to text.

classmethod parse(text)[source]

Parses the given input text to produce a new AttributeListSyntax object.

Returns:the newly created attribute list structure.
Raises :a ParsingError if the syntax is invalid.