title: Transforming opensaml Response object to String, modifying it, then back into a response object
body: <p>I'm trying to modify a SAML Response body contents (to add white space, extra attributes, etc) for testing. But can't seem to find a way to get the marshalled object converted to a string I can modify, then unmarshall back into a Response object.</p>
  
  <p>doing a .toString() (as it mentions here: <a href="https://stackoverflow.com/questions/2472155/i-want-to-convert-an-output-stream-into-string-object">I want to convert an output stream into String object</a>) Just seems to get the main node, not the entirety.</p>
  
  <p>Basically I've been just messing around with</p>
  
  <pre><code>        Element el = XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(response).marshall(response);
  </code></pre>
  
  <p>To try and get it, but thought I'd ask here since I couldn't find it in search. Once I can turn it into a string or XML object seems straight forward to just unmarshall it back (<a href="https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUsrManJavaCreateFromXML" rel="nofollow noreferrer">https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUsrManJavaCreateFromXML</a>)</p>
  
  <p>Thanks!</p>