In this project I am defining object configurations in XML format. An example is this is the case of a contextual menu:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<menu name="remates" widget="uiRemates" onshow="showMenu" >
<action name="add" target="add" title="Nuevo Remate" icon=":/crud/add" disabled="" shortcut="CTRL+Key_A" />
<action name="remove" target="remove" title="Eliminar Remate" icon=":/crud/delete" disabled="" />
<action name="remove_apuesta" target="removeApuesta" title="Eliminar Apuesta" icon=":/crud/delete" disabled="" />
<action name="print_remate" target="printRemate" disabled="" title="Imprimir Remate" />
</menu>
</root>
What I'm doing is recovering that configuration with Python and as you can see in the source [ full code]
def configField(self, field_element):
name = field_element.getAttribute('name')
if not name:
raise ModelConfigFieldnameError(
self.model,
field_element
)
if not name in self.model.field_keys:
raise ModelConfigNotHasFieldError(
self.model,
name,
field_element
)
index_column = self.model.field_keys.index(name)
self.setHeader(field_element, index_column)
field_element
is an object of type <class xml.dom.minidom.Element ..>
My question is, how to determine in which line and column that element is found? To improve the detail of my exceptions when an XML configuration is wrong.