Reviewing the MetadataGenerator, I want to suggest a few changes so it’s easier to extend the class for custom use cases:
1. Ports seem to be hardcoded. I think they should be allowed to be overridden, while set to a default value as they are now.
2. Better controls over what elements are generated. Things like various bindings of SingleSignOnService, AttributeService and more.
3. Mark the writer object as protected, or allow a way for an extension to produce its own content written out by the writer.
4. Skip the generation of all comments, optionally.