NodeValue node = (NodeValue)args[0].itemAt(0); if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; if("document-name".equals(getSignature().getName().getLocalName())) return new StringValue(proxy.getDocument().getFileURI().toString()); else return new IntegerValue(proxy.getDocument().getDocId(), Type.INT); } return Sequence.EMPTY_SEQUENCE; }
DocumentImpl doc = null; if (Type.subTypeOf(args[0].getItemType(), Type.NODE)) { NodeValue node = (NodeValue) args[0].itemAt(0); if (node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy) node; doc = proxy.getDocument(); } } else { String path = args[0].getStringValue(); try { doc = context.getBroker().getXMLResource(XmldbURI.xmldbUriFor(path), Lock.READ_LOCK); } catch (URISyntaxException e) { throw new XPathException(getASTNode(), "Invalid resource uri: " + path,e); } catch (PermissionDeniedException e) { throw new XPathException(getASTNode(), path + ": permission denied to read resource"); } finally { if (doc != null) doc.getUpdateLock().release(Lock.READ_LOCK); } } if (doc != null) { if ("document-name".equals(getSignature().getName().getLocalName())) return new StringValue(doc.getFileURI().toString()); else return new IntegerValue(doc.getDocId(), Type.INT); } return Sequence.EMPTY_SEQUENCE; }
	public Sequence eval(Sequence[] args, Sequence contextSequence)		throws XPathException {		NodeValue node = (NodeValue)args[0].itemAt(0);		if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) {			NodeProxy proxy = (NodeProxy)node;			if("document-name".equals(getSignature().getName().getLocalName()))				return new StringValue(proxy.getDocument().getFileURI().toString());			else				return new IntegerValue(proxy.getDocument().getDocId(), Type.INT);		}		return Sequence.EMPTY_SEQUENCE;	}