- def __init__(self, doc, element):
- doc.actions[element.get("label")] = self
- self.actions = []
+ To support parsing new actions, add tags to
+ ActionDef.CONSTRUCTORS. It maps tag names to classes with a
+ FromElement classmethod, which take the BulletML instance and
+ ElementTree element as arguments.
+ """
+
+ # This is self-referential, so it's filled in later.
+ CONSTRUCTORS = dict()
+
+ def __init__(self, actions):
+ self.actions = list(actions)
+
+ @classmethod
+ def FromElement(cls, doc, element):
+ """Construct using an ElementTree-style element."""
+ actions = []