from xml.sax import ContentHandler, parse

class XmlHandler(ContentHandler):
	def __init__(self):
		self.chars = [  ]
		self.cells = [  ]
		self.rows = [  ]
		self.tables = [  ]
	def characters(self, content):
		self.chars.append(content)
	def startElement(self, name, atts):
		if name=="Cell":
			self.chars = [  ]
		elif name=="Row":
			self.cells=[  ]
		elif name=="Table":
			self.rows = [  ]
	def endElement(self, name):
		if name=="Cell":
			self.cells.append(''.join(self.chars))
		elif name=="Row":
			self.rows.append(self.cells)
		elif name=="Table":
			self.tables.append(self.rows)

	def xml_to_arr(xml_file, sheet=0, start_row=0):
		excelHandler = XmlHandler()
		parse(xml_file, excelHandler)
		data_arr = excelHandler.tables[sheet]
		return data_arr[start_row], data_arr[start_row+1:]