

def write(self, file, depth=0):
    'parse XML structure recursively and append to the output fileID,\n        increasing the offset (tabs) while descending into the tree'
    if ('myName' not in self.tag):
        print('Error parsing XML structure: Tag name missing!')
        sys.exit(1)
    nAttr = self.nbAttributes()
    endmark = '/>'
    if self.hasSubtag():
        endmark = '>'
    if (nAttr > 0):
        file.write((((((((self._tab * depth) + '<') + self.tag['myName']) + ' ') + ' '.join([(((name + '="') + str(val)) + '"') for (name, val) in self.tag.items() if ((name != 'myName') and (name != 'Icontain'))])) + endmark) + '\n'))
    else:
        file.write(((((self._tab * depth) + '<') + self.tag['myName']) + '>\n'))
    if self.hasSubtag():
        for subtag in self.tag['Icontain']:
            subtag.write(file, depth=(depth + 1))
        file.write(((((self._tab * depth) + '</') + self.tag['myName']) + '>\n'))

dataset/ETHPy150Open pybrain/pybrain/pybrain/rl/environments/ode/tools/xmltools.py XMLstruct.write/original