Commit 489977e6 authored by Jérome Perrin's avatar Jérome Perrin

use xpath and local-name() to get table:value-type or office:value-type, both

exists in ODF


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24779 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bc5bb139
......@@ -446,13 +446,18 @@ class OOoParser(Implicit):
# Get the cell content
cell_data = None
value_type = cell.getAttributeNS(self.ns['office'], 'value-type')
value_type = None
# value-type and value attributes can be in table or office
# namespaces, so we use local-name
value_type_attribute_list = cell.xpath('./@*[local-name()="value-type"]')
if value_type_attribute_list:
value_type = value_type_attribute_list[0].value
if value_type == 'date':
cell_data = cell.getAttributeNS(self.ns['office'], 'date-value')
cell_data = cell.xpath('./@*[local-name()="date-value"]')[0].value
elif value_type == 'time':
cell_data = cell.getAttributeNS(self.ns['office'], 'time-value')
cell_data = cell.xpath('./@*[local-name()="time-value"]')[0].value
elif value_type in ('float', 'percentage', 'currency'):
cell_data = cell.getAttributeNS(self.ns['office'], 'value')
cell_data = cell.xpath('./@*[local-name()="value"]')[0].value
else:
text_tags = cell.xpath('.//*[name() = "text:p"]')
if len(text_tags):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment