docs: @Override
      public void xmlWriteOn(FormattedWriter writer) throws IOException
      {
          // Restore an un-cached message to we can dump its state
          if (msg == null)
              getJSMessage(true);
  
          try
          {
              if (msg != null)
              {
                  writer.newLine();
                  writer.taggedValue("JsMessage", msg.getClass().getName());
                  writer.newLine();
                  writer.taggedValue("systemMessageId", msg.getSystemMessageId());
  
                  if (msg instanceof JsApiMessage)
                  {
                      writer.newLine();
                      writer.taggedValue("APIMessageId", ((JsApiMessage) msg).getApiMessageId());
                      writer.newLine();
                      writer.taggedValue("APICorrelId", ((JsApiMessage) msg).getCorrelationId());
                  }
                  else
                  {
                      if (msg.getApiMessageIdAsBytes() != null)
                      {
                          writer.newLine();
                          writer.taggedValue("APIMessageId", new String(msg.getApiMessageIdAsBytes()));
                      }
                      if (msg.getCorrelationIdAsBytes() != null)
                      {
                          writer.newLine();
                          writer.taggedValue("APICorrelId", new String(msg.getCorrelationIdAsBytes()));
                      }
                  }
  
                  writer.newLine();
                  writer.taggedValue("putTime", new Date(msg.getTimestamp()));
  
                  // If this MessageItem is sitting on an xmit ItemStream then we're probably
                  // going to be interested in the GD data in the message.
                  try
                  {
                      ItemStream is = getItemStream();
                      if (is instanceof PtoPXmitMsgsItemStream)
                      {
                          writer.newLine();
                          writer.startTag("xmitData");
                          writer.indent();
  
                          writer.newLine();
                          writer.taggedValue("startTick", msg.getGuaranteedValueStartTick());
                          writer.newLine();
                          writer.taggedValue("endTick", msg.getGuaranteedValueEndTick());
                          writer.newLine();
                          writer.taggedValue("priority", msg.getPriority());
                          writer.newLine();
                          writer.taggedValue("reliability", msg.getReliability());
                          writer.newLine();
                          writer.taggedValue("streamId", msg.getGuaranteedStreamUUID());
                          if (msg.getRoutingDestination() != null)
                          {
                              writer.newLine();
                              writer.taggedValue("routingDestination", msg.getRoutingDestination());
                          }
  
                          writer.outdent();
                          writer.newLine();
                          writer.endTag("xmitData");
                      }
                  } catch (SevereMessageStoreException se)
                  {
                      // No FFDC code needed
                  } catch (RuntimeException re)
                  {
                      // No FFDC code needed
                  }
  
                  String text = null;
                  //if we can easily get the text of the message then use that
                  if (msg instanceof JsJmsTextMessage)
                  {
                      try
                      {
                          text = ((JsJmsTextMessage) msg).getText();
                          if (text != null && text.length() > 40)
                              text = text.substring(0, 37) + "...";
                      } catch (UnsupportedEncodingException e)
                      {
                          // No FFDC code needed
                          text = "Unsupported message encoding";
                      }
                  }
                  else
                      text = String.valueOf(msg);
  
                  writer.newLine();
                  writer.taggedValue("data", text);
              }
          } catch (RuntimeException e)
          {
              // No FFDC code needed
  
              // As we're not locking the state down there's very slim chance of hitting
              // something like a NPE while we do this, we'll just catch it and ignore it
          }
      }