Building document level objects and head element attributes