Dear all,

The Dutch Tax Authority requires Dutch companies to send extracts from their ERP-systems in a standardized format known as XAF (XML Audit File).
I am building a standard Lavastorm project that can handle these XAF files, so I can perform a set of standard analyses on them.
So now I'm experimenting with the XMLpy node to acquire this data.
Being a noob on both XML and Python, I have come farther than I would have thought (read the XML tutorial :-), but now I'm a bit stuck on a more complex (multi-layered) part of the XML file.

The essence of what I want is to be able to extract the data at the lowest (deepest) levels possible, which is 7 or 8 layers deep (!) and extract all this detailed information along with the information from ALL the parent levels it belongs to.
This thing is, the data being returned is at a higher level than expected: I only get 11 records at the "Journal" level (the 3rd level) and only the FIRST piece of information from the level below that. Of course, I was expecting to get tens-of-thousands of records at the 7th or 8th level, being the individual bookings in the ERP system.

I just *know* this can be done, but what am I doing wrong??

A simplified piece of code I use (at like the 4th level or so) is pasted below:

@elementHandler('/auditfile/transactions/journal')
def journalHandler(element):
data = {}
data['journalID'] = None
if hasattr(element, "journalID"):
data['journalID'] = element.journalID
data['description'] = None
if hasattr(element, "description"):
data['description'] = element.description
data['type'] = None
if hasattr(element, "type"):
data['type'] = element.type
data['transaction'] = None
if hasattr(element, "transaction"):
data['transaction_transactionID'] = None
if hasattr(element.transaction, "transactionID"):
data['transaction_transactionID'] = element.transaction.transactionID
data['transaction_description'] = None
if hasattr(element.transaction, "description"):
data['transaction_description'] = element.transaction.description
data['transaction_period'] = None
if hasattr(element.transaction, "period"):
data['transaction_period'] = element.transaction.period
data['transaction_transactionDate'] = None
if hasattr(element.transaction, "transactionDate"):
data['transaction_transactionDate'] = element.transaction.transactionDate
data['transaction_line'] = None
if hasattr(element.transaction, "line"):
data['transaction_line_recordID'] = None
if hasattr(element.transaction.line, "recordID"):
data['transaction_line_recordID'] = element.transaction.line.recordID

outputRecord(data, 0)


Thanks for any and all help!!!
Best regards, Bart.