Hello everyone, someone can help me to know, how I can print dataset from table to XML format?
XML is pretty wide open, but a simple XML output:
import xml.etree.ElementTree as ET
dataIn = system.dataset.toPyDataSet(event.source.parent.getComponent('Power Table').data)
headers = list(dataIn.getUnderlyingDataset().getColumnNames())
tree = ET.Element('dataset')
comment = ET.Comment('Dataset to XML Test')
tree.append(comment)
for row in dataIn:
rowElement = ET.SubElement(tree, 'row')
for col in headers:
colElement = ET.SubElement(rowElement, col)
colElement.text = str(row[col])
xmlString = ET.tostring(tree)
print xmlString