[CXF-5996] Better support for reading caching various entity types
Write the prolog only if it hasn't already been written