示例#1
0
 def parse(self):
     "Do the actual parsing."
     file_ = self.file
     fpath = get_path(file_)
     if is_local(file_) and fpath.endswith("content.xml"):
         # looks like this is a manually-unzipped package,
         dirname = path.split(fpath)[0]
         mfn = path.join(dirname, "mimetype")
         if exists(mfn):
             f = open(mfn)
             mimetype = f.read()
             f.close()
             if mimetype == self.MIMETYPE:
                 self.package.set_meta(PACKAGED_ROOT, dirname)
     # NB: PACKAGED_ROOT may have been set elsewhere, so:
     self.standalone_xml = not self.package.get_meta(PACKAGED_ROOT, None)
     XmlParserBase.parse(self)
示例#2
0
 def __init__(self, file_, package):
     XmlParserBase.__init__(self, file_, package, self._NAMESPACE_URI,
                            "package")
     self._postponed = []