elem getchildren(returns all subelements in document order elem getiterator([tag]returns an iterator that produces all subelements whose type matches tag elem insert(indexsubelementinserts subelement at position index in the list of children elem items(returns all element attributes as list of (namevaluepairs elem keys(returns list of all of the attribute names elem remove(subelementremoves element subelement from the list of children elem set(keyvaluesets attribute key to value value tree building an elementtree object is easy to create from other tree-like structures the following object is used for this purpose treebuilder([element_factory] class that builds an elementtree structure using series of start()end()and data(calls as would be triggered while parsing file or traversing another tree structure element_factory is an operation function that is called to create new element instances an instance of treebuilder has these methodst close(closes the tree builder and returns the top-level elementtree object that has been created data(dataadds text data to the current element being processed end(tagcloses the current element being processed and returns the final element object start(tagattrscreates new element tag is the element nameand attrs is dictionary with the attribute values lib fl ff