/** * Fallback name to be returned if there is anything wrong with the variable's real name * (after reporting an error) * * @return a fallback name */ private StructuredQName errorName() { return new StructuredQName("saxon", NamespaceConstant.SAXON, "error-variable-name"); }
/** * Convert the value to a string. The resulting string is the lexical form of the QName, * using the original prefix if there was one. */ public String toString() { return sqName.getDisplayName(); }
/** * Test whether this UseAttributeSets expression is equal to another * * @param obj the other expression */ public boolean equals(Object obj) { if (!(obj instanceof UseAttributeSet)) { return false; } return targetName.equals(((UseAttributeSet) obj).targetName); }
/** * Convert the StructuredQName to a javax.xml.namespace.QName * * @return an object of class javax.xml.namespace.QName representing this qualified name */ public QName toJaxpQName() { return new javax.xml.namespace.QName(getURI(), getLocalPart(), getPrefix()); }
/** * 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. In the case of a StructuredQName, the identity test compares * prefixes as well as the namespace URI and local name. * * @param other the value to be compared with * @return true if the two values are indentical, false otherwise */ public boolean isIdentical(IdentityComparable other) { return equals(other) && ((StructuredQName)other).getPrefix().equals(getPrefix()); }
qCode = new StructuredQName(code.getPrefix(), code.getNamespaceURI(), code.getLocalName()); treeWriter.addNamespace(qCode.getPrefix(), qCode.getNamespaceBinding().getURI()); treeWriter.addAttribute(_code, qCode.getDisplayName());
XPathException e = (XPathException) exception; StructuredQName errqn = e.getErrorCodeQName(); if (errqn != null && errqn.equals(err_sxxp0003)) { writer.addNamespace(qCode.getPrefix(), qCode.getNamespaceBinding().getURI()); writer.addAttribute(_code, qCode.getDisplayName());
private StructuredQName resolveQName(String val, NodeInfo element) throws XPathException { if (val.startsWith("Q{")) { return StructuredQName.fromEQName(val); } else if (val.contains(":")) { NamespaceResolver resolver = new InscopeNamespaceResolver(element); return StructuredQName.fromLexicalQName(val, true, true, resolver); } else { return new StructuredQName("", "", val); } }
private boolean allowsEarlyEvaluation(Sequence[] arguments, XPathContext context) throws XPathException { StringValue name = (StringValue) arguments[0].head(); try { StructuredQName qName = StructuredQName.fromLexicalQName(name.getStringValue(), false, true, getRetainedStaticContext()); String uri = qName.getURI(); String local = qName.getLocalPart(); return uri.equals(NamespaceConstant.XSLT) && (local.equals("version") || local.equals("vendor") || local.equals("vendor-url") || local.equals("product-name") || local.equals("product-version") || local.equals("supports-backwards-compatibility") || local.equals("xpath-version") || local.equals("xsd-version")); } catch (XPathException err) { throw new XPathException("Invalid system property name. " + err.getMessage(), "XTDE1390", context); } }
/** * Get the QName in Clark notation, that is "{uri}local" if in a namespace, or "local" otherwise * * @return the name in Clark notation */ public final String getClarkName() { return qName.getClarkName(); }
public void setVariableBinding(int role, LocalVariableBinding binding) throws XPathException { for (Iterator<LocalVariableBinding> iter = windowVars.valueIterator(); iter.hasNext(); ) { if (iter.next().getVariableQName().equals(binding.getVariableQName())) { throw new XPathException("Two variables in a window clause cannot have the same name (" + binding.getVariableQName().getDisplayName() + ")", "XQST0103"); } } windowVars.put(role, binding); }
private static StructuredQName getStructuredQName(String vName) { //return new StructuredQName(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart()); return StructuredQName.fromClarkName(vName); }
private QName qnameFor(StructuredQName name) { QName qname = new QName (name.getNamespaceBinding().getURI(), name.getLocalPart(), name.getNamespaceBinding().getPrefix()); if (!(qname.getPrefix().equals ("fn") && qname.getNamespaceURI().equals(FunCall.FN_NAMESPACE) || qname.getPrefix().equals("local") && qname.getNamespaceURI().equals(FunCall.LOCAL_NAMESPACE) || qname.getPrefix().equals("xs") && qname.getNamespaceURI().equals(FunCall.XS_NAMESPACE))) { addNamespaceDeclaration(qname); } return qname; }
private StructuredQName getElementName(String lexicalName) throws XPathException { StructuredQName qName; try { if (lexicalName.indexOf(':') < 0) { CharSequence local = Whitespace.trimWhitespace(lexicalName); if (!NameChecker.isValidNCName(local)) { throw new XPathException("Invalid EQName passed to element-available(): local part is not a valid NCName"); } String uri = getRetainedStaticContext().getURIForPrefix("", true); qName = new StructuredQName("", uri, lexicalName); } else { qName = StructuredQName.fromLexicalQName(lexicalName, false, true, getRetainedStaticContext()); } } catch (XPathException e) { e.setErrorCode("XTDE1440"); throw e; } return qName; }
/** * Get the local part of the QName * * @return the local part of the QName */ public String getLocalPart() { return qName.getLocalPart(); }
/** * Get the prefix of the QName. This plays no role in operations such as comparison * of QNames for equality, but is retained (as specified in XPath) so that a string representation * can be reconstructed. * <p>Returns the zero-length string in the case of a QName that has no prefix.</p> * * @return the prefix part of the QName, or "" if the name has no known prefix */ public String getPrefix() { return sqName.getPrefix(); }
private void computeUriAndLocal() { if (uri == null || localName == null) { StructuredQName name = namePool.getUnprefixedQName(fingerprint); uri = name.getURI(); localName = name.getLocalPart(); } }
/** * Static method to resolve a lexical QName against the namespace context of a supplied element node * * @param lexicalQName the lexical QName * @param element the element node whose namespace context is to be used * @return the result of resolving the QName * @throws XPathException if the supplied value is not a valid lexical QName, or if its namespace * prefix is not in scope */ /*@Nullable*/ public static QNameValue resolveQName(CharSequence lexicalQName, NodeInfo element) throws XPathException { NamespaceResolver resolver = new InscopeNamespaceResolver(element); StructuredQName qName = StructuredQName.fromLexicalQName(lexicalQName, true, false, resolver); return new QNameValue(qName, BuiltInAtomicType.QNAME); }