@Override public boolean effectiveBooleanValue(XPathContext context) throws XPathException { String s0 = getArg(0).evaluateAsString(context).toString(); String s1 = getArg(1).evaluateAsString(context).toString(); return s0.endsWith(s1); } };
@Override public boolean effectiveBooleanValue(XPathContext context) throws XPathException { String s0 = getArg(0).evaluateAsString(context).toString(); String s1 = getArg(1).evaluateAsString(context).toString(); return s0.startsWith(s1); } };
@Override public boolean effectiveBooleanValue(XPathContext context) throws XPathException { String s0 = getArg(0).evaluateAsString(context).toString(); String s1 = getArg(1).evaluateAsString(context).toString(); return s0.endsWith(s1); } };
@Override public boolean effectiveBooleanValue(XPathContext context) throws XPathException { String s0 = getArg(0).evaluateAsString(context).toString(); CharSequence s1 = getArg(1).evaluateAsString(context); return s0.contains(s1); }
@Override public boolean effectiveBooleanValue(XPathContext context) throws XPathException { String s0 = getArg(0).evaluateAsString(context).toString(); CharSequence s1 = getArg(1).evaluateAsString(context); return s0.contains(s1); }
@Override public boolean effectiveBooleanValue(XPathContext context) throws XPathException { String s0 = getArg(0).evaluateAsString(context).toString(); String s1 = getArg(1).evaluateAsString(context).toString(); return s0.startsWith(s1); } };
/** * Evaluate the name of the processing instruction. If it is invalid, report a recoverable error * and return null. * @param context * @return the name of the processing instruction (an NCName), or null, incicating an invalid name * @throws XPathException if evaluation fails, or if the recoverable error is treated as fatal */ private String evaluateName(XPathContext context) throws XPathException { String expandedName = Whitespace.trim(name.evaluateAsString(context)); checkName(expandedName, context); return expandedName; }
/** * Evaluate the name of the processing instruction. If it is invalid, report a recoverable error * and return null. * @param context * @return the name of the processing instruction (an NCName), or null, incicating an invalid name * @throws XPathException if evaluation fails, or if the recoverable error is treated as fatal */ private String evaluateName(XPathContext context) throws XPathException { String expandedName = Whitespace.trim(name.evaluateAsString(context)); checkName(expandedName, context); return expandedName; }
/** * Iterate over the results of the function */ public SequenceIterator iterate(XPathContext context) throws XPathException { if (context.getController().isTracing()) { String label = argument[1].evaluateAsString(context).toString(); Value value = Value.asValue(ExpressionTool.eagerEvaluate(argument[0], context)); notifyListener(label, value, context); return value.iterate(); } else { return new TracingIterator(argument[0].iterate(context), argument[1].evaluateAsString(context).toString()); } }
/** * Iterate over the results of the function */ public SequenceIterator iterate(XPathContext context) throws XPathException { if (context.getController().isTracing()) { String label = argument[1].evaluateAsString(context).toString(); Value value = Value.asValue(ExpressionTool.eagerEvaluate(argument[0], context)); notifyListener(label, value, context); return value.iterate(); } else { return new TracingIterator(argument[0].iterate(context), argument[1].evaluateAsString(context).toString()); } }
public SortKeyDefinition fix(XPathContext context) throws XPathException { SortKeyDefinition newSKD = this.copy(new RebindingMap()); newSKD.setLanguage(new StringLiteral(this.getLanguage().evaluateAsString(context))); newSKD.setOrder(new StringLiteral(this.getOrder().evaluateAsString(context))); if (collationName != null) { newSKD.setCollationNameExpression(new StringLiteral(this.getCollationNameExpression().evaluateAsString(context))); } newSKD.setCaseOrder(new StringLiteral(this.getCaseOrder().evaluateAsString(context))); if (dataTypeExpression != null) { newSKD.setDataTypeExpression(new StringLiteral(this.getDataTypeExpression().evaluateAsString(context))); } newSKD.setSortKey(new ContextItemExpression(), true); return newSKD; }
public SortKeyDefinition fix(XPathContext context) throws XPathException { SortKeyDefinition newSKD = this.copy(new RebindingMap()); newSKD.setLanguage(new StringLiteral(this.getLanguage().evaluateAsString(context))); newSKD.setOrder(new StringLiteral(this.getOrder().evaluateAsString(context))); if (collationName != null) { newSKD.setCollationNameExpression(new StringLiteral(this.getCollationNameExpression().evaluateAsString(context))); } newSKD.setCaseOrder(new StringLiteral(this.getCaseOrder().evaluateAsString(context))); if (dataTypeExpression != null) { newSKD.setDataTypeExpression(new StringLiteral(this.getDataTypeExpression().evaluateAsString(context))); } newSKD.setSortKey(new ContextItemExpression(), true); return newSKD; }
/** * Evaluate the function */ public Item evaluateItem(XPathContext context) throws XPathException { Item val = argument[0].evaluateItem(context); String label = argument[1].evaluateAsString(context).toString(); if (context.getController().isTracing()) { notifyListener(label, Value.asValue(val), context); } else { traceItem(val, label); } return val; }
/** * Evaluate the function */ public Item evaluateItem(XPathContext context) throws XPathException { Item val = argument[0].evaluateItem(context); String label = argument[1].evaluateAsString(context).toString(); if (context.getController().isTracing()) { notifyListener(label, Value.asValue(val), context); } else { traceItem(val, label); } return val; }
/** * Evaluate the function */ public Item evaluateItem(XPathContext context) throws XPathException { Item val = argument[0].evaluateItem(context); String label = argument[1].evaluateAsString(context).toString(); Controller controller = context.getController(); if (controller.isTracing()) { notifyListener(label, Value.asValue(val), context); } else { PrintStream out = controller.getTraceFunctionDestination(); if (out != null) { traceItem(val, label, out); } } return val; }
private String processShadowAttribute(String expression, String baseUri, AttributeLocation loc) throws XPathException { UseWhenStaticContext staticContext = new UseWhenStaticContext(compilation, startTag); staticContext.setBaseURI(baseUri); staticContext.setContainingLocation(loc); setNamespaceBindings(staticContext); Expression expr = AttributeValueTemplate.make(expression, staticContext); expr = typeCheck(expr, staticContext); SlotManager stackFrameMap = allocateSlots(expression, expr); XPathContext dynamicContext = makeDynamicContext(staticContext); ((XPathContextMajor) dynamicContext).openStackFrame(stackFrameMap); return expr.evaluateAsString(dynamicContext).toString(); }
private String processShadowAttribute(String expression, String baseUri, AttributeLocation loc) throws XPathException { UseWhenStaticContext staticContext = new UseWhenStaticContext(compilation, startTag); staticContext.setBaseURI(baseUri); staticContext.setContainingLocation(loc); setNamespaceBindings(staticContext); Expression expr = AttributeValueTemplate.make(expression, staticContext); expr = typeCheck(expr, staticContext); SlotManager stackFrameMap = allocateSlots(expression, expr); XPathContext dynamicContext = makeDynamicContext(staticContext); ((XPathContextMajor) dynamicContext).openStackFrame(stackFrameMap); return expr.evaluateAsString(dynamicContext).toString(); }
private String evaluatePrefix(XPathContext context) throws XPathException { String prefix = Whitespace.trim(name.evaluateAsString(context)); if (!(prefix.length() == 0 || context.getConfiguration().getNameChecker().isValidNCName(prefix))) { XPathException err = new XPathException("Namespace prefix is invalid: " + prefix, this); err.setErrorCode("XTDE0920"); err.setXPathContext(context); throw dynamicError(this, err, context); } if (prefix.equals("xmlns")) { XPathException err = new XPathException("Namespace prefix 'xmlns' is not allowed", this); err.setErrorCode("XTDE0920"); err.setXPathContext(context); throw dynamicError(this, err, context); } return prefix; }
private String evaluatePrefix(XPathContext context) throws XPathException { String prefix = Whitespace.trim(name.evaluateAsString(context)); if (!(prefix.length() == 0 || context.getConfiguration().getNameChecker().isValidNCName(prefix))) { XPathException err = new XPathException("Namespace prefix is invalid: " + prefix, this); err.setErrorCode("XTDE0920"); err.setXPathContext(context); throw dynamicError(this, err, context); } if (prefix.equals("xmlns")) { XPathException err = new XPathException("Namespace prefix 'xmlns' is not allowed", this); err.setErrorCode("XTDE0920"); err.setXPathContext(context); throw dynamicError(this, err, context); } return prefix; }
/** * Evaluate as an expression. We rely on the fact that when these instructions * are generated by XQuery, there will always be a valueExpression to evaluate * the content */ public Item evaluateItem(XPathContext context) throws XPathException { String content = (select==null ? "" : select.evaluateAsString(context).toString()); content = checkContent(content, context); final TypeHierarchy th = context.getConfiguration().getTypeHierarchy(); Orphan o = new Orphan(context.getConfiguration()); o.setNodeKind((short)getItemType(th).getPrimitiveType()); o.setStringValue(content); o.setNameCode(evaluateNameCode(context)); return o; }