Next: Character data the pcdata
Up: The standard matchers
Previous: The tag+ matcher
Contents
The attr matcher
The attr matcher matches an attribute.
Syntax:
attr name &key how-many possible-values type matches-regexp test-fn matcher
Arguments and Values:
name--One of three things:
- A regular expression that will match the name of the attribute. Note that ``^'' and ``$'' are added to the
start and end of the regular expression string.
- A cons of two regular expressions, both of which have ``^'' and ``$'' added as above, which match each element
of the (attribute-name . namespace) cons used by xmls to represent namespaces.
- A designator for a function. This is called on the attribute name (which may be a string or a
cons, as described above) and returns a boolean representing whether or not the function matches the attribute name.
how-many--a symbol indicating how many times the attribute can match children of its parent tag. One of:
- :one--matches one
- :one-or-more--matches one or more
- :zero-or-more--matches zero or more
- :zero-or-one--matches zero or one (an optional matcher, in other words)
possible-values--a list of strings that are all the possible values of the attribute.
type--a type specifier for the type of the attribute's value when it has been read by the Common Lisp reader.
matches-regexp--a regular expression which the attribute's value must match. Note that ``^'' and ``$'' are
added to the start and end of the regular expression.
test-fn--a designator for a function that takes the attribute's value as an argument and returns a boolean indicating
whether or not the value should be matched. This lets you use the full power of Common Lisp in your sanity checking.
matcher--the matcher object returned.
Next: Character data the pcdata
Up: The standard matchers
Previous: The tag+ matcher
Contents
root
2004-10-26