Refactored DocTypeBuilder to make it easier to test