Example #1
0
    def dumpXML(self):
        self.__parseFile()
        dirs = self.strm.getDirectoryEntries()
        docroot = node.Root()
        root = docroot.appendElement('xls-dump')

        for d in dirs:
            if d.Name != "Workbook":
                # for now, we only dump the Workbook directory stream.
                continue

            dirstrm = self.strm.getDirectoryStream(d)
            data = self.__readSubStreamXML(dirstrm)
            self.__dumpDataAsXML(data, root)
        node.prettyPrint(sys.stdout, docroot, utf8=self.params.utf8)
Example #2
0
    def dumpCanonicalXML (self):
        self.__parseFile()
        docroot = node.Root()
        root = docroot.appendElement('xls-dump')

        dirEntries = self.strm.getDirectoryEntries()
        for entry in dirEntries:
            dirname = entry.Name
            if dirname != b"Workbook":
                # for now, we only dump the Workbook directory stream.
                continue

            dirstrm = self.strm.getDirectoryStream(entry)
            wbmodel = self.__buildWorkbookModel(dirstrm)
            wbmodel.encrypted = self.strmData.encrypted
            root.appendChild(wbmodel.createDOM())

        node.prettyPrint(globals.utfwriter(), docroot, utf8 = self.params.utf8)
Example #3
0
    def dumpCanonicalXML(self):
        try:
            self.__parseFile()
            docroot = node.Root()
            root = docroot.appendElement('xls-dump')

            dirEntries = self.strm.getDirectoryEntries()
            for entry in dirEntries:
                dirname = entry.Name
                if dirname != "Workbook":
                    # for now, we only dump the Workbook directory stream.
                    continue

                dirstrm = self.strm.getDirectoryStream(entry)
                wbmodel = self.__buildWorkbookModel(dirstrm)
                wbmodel.encrypted = self.strmData.encrypted
                root.appendChild(wbmodel.createDOM())

                node.prettyPrint(sys.stdout, docroot, utf8=self.params.utf8)

        except Exception as err:
            print >> sys.stderr, "xls-dump.py: error: %s" % err
            sys.exit(1)