#!/usr/bin/env python from __future__ import print_function import emitter class XMLEmitter(emitter.Emitter): def preface(self): return """ """ def postface(self): return "" def start(self): self.fh = open("LogMessages.xml", mode='w') print(self.preface(), file=self.fh) def emit(self, doccos): self.start() for docco in doccos: print(' ' % docco.name, file=self.fh) if docco.url is not None: print(' %s' % docco.url, file=self.fh) if docco.description is not None: print(' %s' % docco.description, file=self.fh) print(' ', file=self.fh) for f in docco.fields_order: print(' ' % f, file=self.fh) if "description" in docco.fields[f]: print(' %s' % docco.fields[f]["description"], file=self.fh) if "bits" in docco.fields[f]: print(' %s' % docco.fields[f]["bits"], file=self.fh) print(' ', file=self.fh) print(' ', file=self.fh) print(' ', file=self.fh) print("", file=self.fh) self.stop() def stop(self): print(self.postface(), file=self.fh) self.fh.close()