I have some XML that is generated by a script that may or may not have empty elements. I was told that now we cannot have empty elements in the XML. Here is an example:\[code\]<customer> <govId> <id>@</id> <idType>SSN</idType> </govId> <govId> <id/> <idType/> <issueDate/> <expireDate/> <dob/> <state/> <county/> <country/> </govId></customer>\[/code\]I need to remove all the empty elements. You'll note that my code took out the empty stuff in the "govId" sub-element, but didn't take out anything in the second. I am using lxml.objectify at the moment.Here is basically what I am doing:\[code\]root = objectify.fromstring(xml)for customer in root.customers.iterchildren(): for e in customer.govId.iterchildren(): if not e.text: customer.govId.remove(e)\[/code\]Does anyone know of a way to do this with lxml objectify or is there an easier way period? I would also like to remove the second "govId" element in its entirety if all its elements are empty.