I'm stepping through implementing required features for our build in a Pipeline job. I've been hitting restrictions on what I can do with Groovy in a Jenkinsfile. Right now, I can't figure out how to just emit valid XML. When I try to use MarkupBuilder, it tells me that I can't use "new MarkupBuilder" or "new StringWriter". I tried other strategies, but those use static methods, which are also apparently not allowed.
I need to solve this particular problem, but I also need better understanding of the overall restrictions in a Jenkinsfile, and perhaps WHY those restrictions are there.