I'm using minidom (among others) in Python to pull a list of files from a directory, get their modified times, other misc. data and then write that data to an XML file. The data prints just fine, but when I try to write the data to a file, I only get the XML for one of the files in the directory. Here is my code (I've removed a good amount of createElement and appendChild methods as well as any non-relevant variables for the sake of readability/space):
for filename in os.listdir((os.path.join('\\\\10.10.10.80\Jobs\success'))):
doc = Document()
modTime = datetime.datetime.fromtimestamp(os.path.getmtime('\\\\10.10.10.80\Jobs\success\\'+filename)).strftime('%I:%M:%S %p')
done = doc.createElement('Printed Orders')
doc.appendChild(done)
ordernum = doc.createElement(filename)
done.appendChild(ordernum)
#This is where other child elements have been removed
print doc.toprettyxml(indent=' ')
xmlData = open(day_path, 'w')
xmlData.write(doc.toprettyxml(indent=' '))
Hopefully this is enough to see what's going on. Since print returns the values I am expecting, I think that the write function is where I'm going wrong.