XMLResource resource = (XMLResource) collection.createResource(files[j].getName(), "XMLResource");
Resource resource = collection.createResource(files[j].getName(), resourceType);
	protected Sequence evalWithCollection(Collection collection, Sequence[] args,			Sequence contextSequence) throws XPathException {				File baseDir = new File(args[1].getStringValue());		Sequence patterns = args[2];		ValueSequence stored = new ValueSequence();		for(SequenceIterator i = patterns.iterate(); i.hasNext(); ) {			String pattern = i.nextItem().getStringValue();			File[] files = DirectoryScanner.scanDir(baseDir, pattern);			for(int j = 0; j < files.length; j++) {				try {					XMLResource resource =						(XMLResource) collection.createResource(files[j].getName(), "XMLResource");					resource.setContent(files[j]);					collection.storeResource(resource);					stored.add(new StringValue(collection.getName() + '/' + resource.getId()));				} catch (XMLDBException e) {					throw new XPathException(getASTNode(), "Could not store file " + files[j].getAbsolutePath() + 							": " + e.getMessage(), e);				}			}		}		return stored;	}