Everything up to this line could go in a separate method so that the basic algorithm in this method is clear:
```java
public Element buildTU(SourceContents tu) throws IOException
{
   Element textUnit = new Element("tu");
   setAttributesFromSourceContents(textUnit, tu);
   for (Element tuv : buildTUVs(tu))
   {
      textUnit.appendChild(tuv);
   }
   return textUnit;
}
```