protected FingerprintedQName fQNameFor (String prefix, String namespace, String name) { return new FingerprintedQName(prefix, namespace, name); }
/** * 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; }
/** * Determine whether two IdentityComparable objects are identical. This is a stronger * test than equality (even schema-equality); for example two dateTime values are not identical unless * they are in the same timezone. * * @param other the other value * @return true if the two values are indentical, false otherwise */ public boolean isIdentical(IdentityComparable other) { return other instanceof NodeName && this.equals(other) && this.getPrefix().equals(((NodeName) other).getPrefix()); }
/** * Create a QName in null namespace * * @param s the local name * @return the QName */ private FingerprintedQName qname(String s) { FingerprintedQName fp = new FingerprintedQName("", "", s); fp.obtainFingerprint(namePool); return fp; }
@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; } }
public boolean equals(/*@NotNull*/ Object other) { if (other instanceof NodeName) { if (fingerprint != -1 && ((NodeName) other).hasFingerprint()) { return getFingerprint() == ((NodeName) other).getFingerprint(); } else { return getLocalPart().equals(((NodeName) other).getLocalPart()) && isInSameNamespace((NodeName) other); } } else { return false; } }
/** * Set the properties for this indenter * * @param props the serialization properties */ public void setOutputProperties(Properties props) { String s = props.getProperty(SaxonOutputKeys.SUPPRESS_INDENTATION); if (s != null) { suppressed = new HashSet<>(8); StringTokenizer st = new StringTokenizer(s, " \t\r\n"); while (st.hasMoreTokens()) { String clarkName = st.nextToken(); suppressed.add(FingerprintedQName.fromClarkName(clarkName).getLocalPart().toLowerCase()); } } }
/** * Set the properties for this indenter * * @param props the serialization properties */ public void setOutputProperties(Properties props) { String omit = props.getProperty(OutputKeys.OMIT_XML_DECLARATION); afterEndTag = omit == null || !"yes".equals(Whitespace.trim(omit)) || props.getProperty(OutputKeys.DOCTYPE_SYSTEM) != null; String s = props.getProperty(SaxonOutputKeys.SUPPRESS_INDENTATION); if (s == null) { s = props.getProperty("{http://saxon.sf.net/}suppress-indentation"); // for compatibility: since 9.3 also available in default namespace } if (s != null) { suppressedElements = new HashSet<NodeName>(8); StringTokenizer st = new StringTokenizer(s, " \t\r\n"); while (st.hasMoreTokens()) { String clarkName = st.nextToken(); suppressedElements.add(FingerprintedQName.fromClarkName(clarkName)); } } }
@Override public String toShortString() { return "@" + attributeName.getDisplayName(); }
@Override public void export(ExpressionPresenter out) { out.startElement("attVal", this); out.emitAttribute("name", attributeName.getStructuredQName()); out.emitAttribute("chk", "" + requiredChecks); out.endElement(); } }
@Override public boolean equals(Object obj) { return obj instanceof AttributeGetter && ((AttributeGetter)obj).attributeName.equals(attributeName); }
@Override public int computeHashCode() { return 83571 ^ attributeName.hashCode(); }
/** * Create a QName in the JSON namespace * * @param s the local name * @return the QName */ private FingerprintedQName qnameNS(String s) { FingerprintedQName fp = new FingerprintedQName(PREFIX, JSON_NS, s); fp.obtainFingerprint(namePool); return fp; }
@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; } }
public boolean equals(/*@NotNull*/ Object other) { if (other instanceof NodeName) { if (fingerprint != -1 && ((NodeName) other).hasFingerprint()) { return getFingerprint() == ((NodeName) other).getFingerprint(); } else { return getLocalPart().equals(((NodeName) other).getLocalPart()) && isInSameNamespace((NodeName) other); } } else { return false; } }
/** * Set the properties for this indenter * * @param props the serialization properties */ public void setOutputProperties(Properties props) { String s = props.getProperty(SaxonOutputKeys.SUPPRESS_INDENTATION); if (s != null) { suppressed = new HashSet<>(8); StringTokenizer st = new StringTokenizer(s, " \t\r\n"); while (st.hasMoreTokens()) { String clarkName = st.nextToken(); suppressed.add(FingerprintedQName.fromClarkName(clarkName).getLocalPart().toLowerCase()); } } }
/** * Set the properties for this indenter * * @param props the serialization properties */ public void setOutputProperties(Properties props) { String omit = props.getProperty(OutputKeys.OMIT_XML_DECLARATION); afterEndTag = omit == null || !"yes".equals(Whitespace.trim(omit)) || props.getProperty(OutputKeys.DOCTYPE_SYSTEM) != null; String s = props.getProperty(SaxonOutputKeys.SUPPRESS_INDENTATION); if (s == null) { s = props.getProperty("{http://saxon.sf.net/}suppress-indentation"); // for compatibility: since 9.3 also available in default namespace } if (s != null) { suppressedElements = new HashSet<NodeName>(8); StringTokenizer st = new StringTokenizer(s, " \t\r\n"); while (st.hasMoreTokens()) { String clarkName = st.nextToken(); suppressedElements.add(FingerprintedQName.fromClarkName(clarkName)); } } }
public String toString() { return "data(@" + attributeName.getDisplayName() + ")"; }
@Override public void export(ExpressionPresenter out) { out.startElement("attVal", this); out.emitAttribute("name", attributeName.getStructuredQName()); out.emitAttribute("chk", "" + requiredChecks); out.endElement(); } }
@Override public boolean equals(Object obj) { return obj instanceof AttributeGetter && ((AttributeGetter)obj).attributeName.equals(attributeName); }