Functional XML serialization