XMLResource resource = (XMLResource) result.getResource(i);
resource = (XMLResource) result.getResource(i);
	public void generate()		throws IOException, SAXException, ProcessingException {		if (inputSource == null)			throw new ProcessingException("No input source");		Request request = ObjectModelHelper.getRequest(objectModel);		Session session = request.getSession(createSession);		try {			Collection collection = DatabaseManager.getCollection(collectionURI, user, password);			if(collection == null) {				if(getLogger().isErrorEnabled())					getLogger().error("Collection " + collectionURI + " not found");				throw new ProcessingException("Collection " + collectionURI + " not found");			}			XPathQueryServiceImpl service = (XPathQueryServiceImpl)				collection.getService("XPathQueryService", "1.0");			service.setProperty(Serializer.GENERATE_DOC_EVENTS, "false");						service.declareVariable("request", request);			service.declareVariable("session", session);						String xquery = readQuery();			if(mapRequestParams)				mapRequestParams(request, service);			ResourceSet result = service.query(xquery);			this.contentHandler.startDocument();			for(long i = 0; i < result.getSize(); i++) {				XMLResource resource = (XMLResource) result.getResource(i);				resource.getContentAsSAX(this.contentHandler);			}			this.contentHandler.endDocument();		} catch (XMLDBException e) {			throw new ProcessingException("XMLDBException occurred: " + e.getMessage(), e);		}	}