/** * Get the fingerprint of this name, allocating a new code from the namepool if necessary * * @param pool the NamePool used to allocate the name * @return a fingerprint for this name, newly allocated if necessary */ public int obtainFingerprint(NamePool pool) { if (fingerprint == -1) { fingerprint = pool.allocateFingerprint(getURI(), getLocalPart()); } return fingerprint; }
/** * Get the fingerprint of this name, allocating a new code from the namepool if necessary * * @param pool the NamePool used to allocate the name * @return a fingerprint for this name, newly allocated if necessary */ public int obtainFingerprint(NamePool pool) { if (fingerprint == -1) { fingerprint = pool.allocateFingerprint(getURI(), getLocalPart()); } return fingerprint; }
path.addPathSegment(AxisType.ATTRIBUTE, an.getURI(), an.getLocalPart());
@Override public Item evaluateItem(XPathContext context) throws XPathException { Item item = context.getContextItem(); if (item instanceof TinyElementImpl) { // fast path String val = ((TinyElementImpl) item).getAttributeValue(attributeName.getFingerprint()); return val == null ? null : new UntypedAtomicValue(val); } if (item == null) { // This doesn't actually happen, we don't create an AttributeGetter unless we know statically dynamicError("The context item for @" + attributeName.getDisplayName() + " is absent", "XPDY0002", context); } if (!(item instanceof NodeInfo)) { typeError("The context item for @" + attributeName.getDisplayName() + " is not a node", "XPDY0002", context); } assert item instanceof NodeInfo; NodeInfo node = (NodeInfo) item; if (node.getNodeKind() == Type.ELEMENT) { String val = node.getAttributeValue(attributeName.getURI(), attributeName.getLocalPart()); return val == null ? null : new UntypedAtomicValue(val); } else { return null; } }
@Override public Item evaluateItem(XPathContext context) throws XPathException { Item item = context.getContextItem(); if (item instanceof TinyElementImpl) { // fast path String val = ((TinyElementImpl) item).getAttributeValue(attributeName.getFingerprint()); return val == null ? null : new UntypedAtomicValue(val); } if (item == null) { dynamicError("The context item for @" + attributeName.getDisplayName() + " is absent", "XPDY0002", context); } if (!(item instanceof NodeInfo)) { typeError("The context item for @" + attributeName.getDisplayName() + " is not a node", "XPDY0002", context); } assert item instanceof NodeInfo; NodeInfo node = (NodeInfo) item; if (node.getNodeKind() == Type.ELEMENT) { String val = node.getAttributeValue(attributeName.getURI(), attributeName.getLocalPart()); return val == null ? null : new UntypedAtomicValue(val); } else { return null; } }