parseAttributes(self,
node,
required=None,
optional=None,
type=<type 'str'>)
| source code
|
Checks the validity of the attributes on an XML node, via
Parser.checkAttributes, then parses them out and returns them all as a
tuple.
- Parameters:
node (xml.dom.Node) - An XML DOM node.
required (Sequence (list, tuple, ...) of strings.) - Set of required attributes, or None.
optional (Sequence (list, tuple, ...) of strings.) - Set of optional attributes, or None.
type (Function of type object -> object.) - Type to which to cast attribute values. The original values will
always be unicode objects; in most cases you want `str' objects,
so this defaults to `str'.
- Returns: tuple of string or None, as long as the combined length of the
required and optional attributes.
- List of all attributes as a tuple. The first element of the
returned tuple will be the value of the first required attribute,
the second the value of the second required attribute, and so on.
The optional attributes follow, with None as the value if the
optional attribute was not present.
|