def xmldump_flat(hwp5file, output, xml_declaration=True): xmlevents = xmlevents_from_hwp5file(hwp5file) bytechunks = xmlevents_to_bytechunks(xmlevents) if xml_declaration: output.write('<?xml version="1.0" encoding="utf-8"?>') for x in bytechunks: output.write(x)
def bytechunks(self, **kwargs): from hwp5.xmlformat import xmlevents_to_bytechunks encoding = kwargs.get('xml_encoding', 'utf-8') bytechunks = xmlevents_to_bytechunks(self, encoding) yield '<?xml version="1.0" encoding="%s"?>\n' % encoding for chunk in bytechunks: yield chunk
def bytechunks(self, xml_declaration=True, **kwargs): from hwp5.xmlformat import xmlevents_to_bytechunks encoding = kwargs.get('xml_encoding', 'utf-8') if xml_declaration: yield '<?xml version="1.0" encoding="%s"?>\n' % encoding bytechunks = xmlevents_to_bytechunks(self, encoding) for chunk in bytechunks: yield chunk