build dom tree