public void deserialize(
     ConnectionResult connectionResult,
     XFormsModelSubmission.SubmissionParameters p,
     XFormsModelSubmission.SecondPassParameters p2)
     throws Exception {
   // Deserialize here so it can run in parallel
   if (XMLUtils.isXMLMediatype(connectionResult.getResponseMediaType())) {
     // XML media type
     final IndentedLogger detailsLogger = getDetailsLogger(p, p2);
     resultingDocumentOrDocumentInfo =
         deserializeInstance(detailsLogger, p2.isReadonly, p2.isHandleXInclude, connectionResult);
   } else {
     // Other media type is not allowed
     throw new XFormsSubmissionException(
         submission,
         "Body received with non-XML media type for replace=\"instance\": "
             + connectionResult.getResponseMediaType(),
         "processing instance replacement",
         new XFormsSubmitErrorEvent(
             submission, XFormsSubmitErrorEvent.RESOURCE_ERROR(), connectionResult));
   }
 }