def serialize_locator(locator): wrapper = XMLWrapper() dom = wrapper.create_document('spreadsheet_locator') root = dom.documentElement root.setAttribute("version", "1.0") locator.serialize(dom,root) return dom.toxml()
def serialize_locator(locator): wrapper = XMLWrapper() dom = wrapper.create_document('spreadsheet_locator') root = dom.documentElement root.setAttribute("version", "1.0") locator.serialize(dom, root) return dom.toxml()
def parse_locator(text): locator = None wrapper = XMLWrapper() dom = wrapper.create_document_from_string(text) root = dom.documentElement version = None version = root.getAttribute('version') if version == '1.0': for element in named_elements(root, 'locator'): if str(element.getAttribute('type')) == 'file': locator = FileLocator.parse(element) elif str(element.getAttribute('type')) == 'db': locator = DBLocator.parse(element) return locator