Mclovin 0 Newbie Poster

Hi! I'm creating metadata to a bunch of files and have problems figuring out how to do this. The python script should be able to create one xml document for each file in the directory. The problem is not to walk through the files but to create additional metadata to it. Also, I have written a script which generates the general form of xml code (for only ONE file) using minidom in python and now want to implement small changes in the output depending on the file.

For now, I'm using:

md = doc.createElement("metadata")
    doc.appendChild(md)
    
    FileID = doc.createElement("mdFileID")
    md.appendChild(FileID)
    txt = doc.createTextNode("texttexttext") # input
    FileID.appendChild(txt)

    output = file('dir/new.xml', 'w')
    output.write(doc.toprettyxml(indent="  "))
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.