code: public void set(ResultItem item){
          try {
              if (item.getValueType() == ValueType.DOCUMENT) {
                  content = item.asString().getBytes("UTF-8");
                  contentType = ContentType.XML;
              } else if (item.getValueType() == ValueType.ELEMENT) {
                  content = item.asString().getBytes("UTF-8");
                  contentType = ContentType.XML;
              } else if (item.getValueType() == ValueType.TEXT) {
                  content = item.asString().getBytes("UTF-8");
                  contentType = ContentType.TEXT;
              } else if (item.getValueType() == ValueType.BINARY) {
                  if (item.isCached()) {
                      content = ((XdmBinary) item.getItem()).asBinaryData();
                  } else {
                      is = item.asInputStream();
                  }
                  contentType = ContentType.BINARY;
              } else if (item.getValueType() == ValueType.ARRAY_NODE ||
                  item.getValueType() == ValueType.BOOLEAN_NODE ||
                  item.getValueType() == ValueType.NULL_NODE ||
                  item.getValueType() == ValueType.NUMBER_NODE ||
                  item.getValueType() == ValueType.OBJECT_NODE) {
                  content = item.asString().getBytes("UTF-8");
                  contentType = ContentType.JSON;
              } else {
                  contentType = ContentType.UNKNOWN;
              }
          } catch (UnsupportedEncodingException e) {
              LOG.error(e);
          }
      }
docs: /* (non-Javadoc)
  @see com.marklogic.mapreduce.MarkLogicDocument#set(com.marklogic.xcc.ResultItem)