class XPathProvider implements MessageBodyReader<T> {

    public T readFrom(Class<T> cls, Type type, Annotation[] anns, MediaType mt,
        MultivaluedMap<String, String> hrs, InputStream is) throws IOException, WebApplicationException {
        String expression = globalExpression != null ? globalExpression
            : classExpressions.get(cls.getName());
        if (expression == null) {
            // must not happen if isReadable() returned true
            throw ExceptionUtils.toInternalServerErrorException(null, null);
        }
        XMLSource source = new XMLSource(is);
        if (forceDOM) {
            source.setBuffering();
        }
        return source.getNode(expression, globalNamespaces, cls);
    }

}