Use attribute iterator to simplify HTML serializer