if (pos < 0 || pos >= resources.size())
{return null;}
final Object r = resources.get((int) pos);
LocalXMLResource res = null;
if (r instanceof NodeProxy) {
final NodeProxy p = (NodeProxy) r;
// the resource might belong to a different collection
// than the one by which this resource set has been
// generated: adjust if necessary.
LocalCollection coll = collection;
if (p.getDocument().getCollection() == null
|| coll.getCollection().getId() != p.getDocument().getCollection().getId()) {
coll = new LocalCollection(user, brokerPool, null, p.getDocument().getCollection().getURI(), coll.getAccessContext());
coll.properties = outputProperties;
}
res = new LocalXMLResource(user, brokerPool, coll, p);
} else if (r instanceof Node) {
res = new LocalXMLResource(user, brokerPool, collection, XmldbURI.EMPTY_URI);