2 from .builders import get_builder_class
3 from .parser import parser
8 def __init__(self, tree=None, filename=None):
9 if filename is not None:
10 tree = etree.parse(filename, parser=parser)
12 tree.getroot().document = self
13 self.base_meta = dcparser.BookInfo({}, {}, validate_required=False)
17 # Allow metadata of the master element as document meta.
18 #master = self.tree.getroot()[-1]
19 return self.tree.getroot().meta
22 def build(self, builder_id, **kwargs):
23 return get_builder_class(builder_id)().build(self, **kwargs)