@Test
  public void testScanUsingListenerUnmarshallerXML() throws Exception {
    StringBuilder builder = new StringBuilder();
    builder.append("/*");
    builder.append("?");
    builder.append(Constants.SCAN_COLUMN + "=" + COLUMN_1);
    builder.append("&");
    builder.append(Constants.SCAN_LIMIT + "=10");
    Response response = client.get("/" + TABLE + builder.toString(), Constants.MIMETYPE_XML);
    assertEquals(200, response.getCode());
    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
    JAXBContext context =
      JAXBContext.newInstance(ClientSideCellSetModel.class, RowModel.class, CellModel.class);
    Unmarshaller unmarshaller = context.createUnmarshaller();

    final ClientSideCellSetModel.Listener listener = new ClientSideCellSetModel.Listener() {
      @Override
      public void handleRowModel(ClientSideCellSetModel helper, RowModel row) {
        assertTrue(row.getKey() != null);
        assertTrue(row.getCells().size() > 0);
      }
    };

    // install the callback on all ClientSideCellSetModel instances
    unmarshaller.setListener(new Unmarshaller.Listener() {
      @Override
      public void beforeUnmarshal(Object target, Object parent) {
        if (target instanceof ClientSideCellSetModel) {
          ((ClientSideCellSetModel) target).setCellSetModelListener(listener);
        }
      }

      @Override
      public void afterUnmarshal(Object target, Object parent) {
        if (target instanceof ClientSideCellSetModel) {
          ((ClientSideCellSetModel) target).setCellSetModelListener(null);
        }
      }
    });

    // create a new XML parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setNamespaceAware(true);
    XMLReader reader = factory.newSAXParser().getXMLReader();
    reader.setContentHandler(unmarshaller.getUnmarshallerHandler());
    assertFalse(ClientSideCellSetModel.listenerInvoked);
    reader.parse(new InputSource(response.getStream()));
    assertTrue(ClientSideCellSetModel.listenerInvoked);

  }
An example to scan using listener in unmarshaller for XML.
@throws Exception the exception
hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java