public FilteredFunctionContext(Set<String> illegalFunctions) { this.illegalFunctions = illegalFunctions; base = XPathFunctionContext.getInstance(); }
/** @return true if the pattern matches the given node */ public boolean matches( Object node, Context context ) { return nodeType == context.getNavigator().getNodeType( node ); }
public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getSelfAxisIterator( contextNode ); } }
public static void registerSelfInSimpleContext() { ((SimpleFunctionContext) XPathFunctionContext.getInstance()).registerFunction(null, "metric", new MetricFunction()); } }
/** Retrieve the current <code>Navigator</code>. * * @return the navigator */ public Navigator getNavigator() { return getContextSupport().getNavigator(); }
/** Translate a namespace prefix to its URI. * * @param prefix the prefix * * @return the namespace URI mapped to the prefix */ public String translateNamespacePrefixToUri(String prefix) { return getContextSupport().translateNamespacePrefixToUri( prefix ); }
@Override public Function getFunction(String namespaceURI, String prefix, String localName) throws UnresolvableException { if (localName != null && illegalFunctions.contains(localName.toLowerCase(Locale.ENGLISH))) { throw new UnresolvableException("Illegal function: " + localName); } return base.getFunction(namespaceURI, prefix, localName); } }
/** @return true if the pattern matches the given node */ public boolean matches( Object node, Context context ) { return context.getNavigator().isText( node ); }
public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getNamespaceAxisIterator( contextNode ); } }
public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getAncestorAxisIterator( contextNode ); }
public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getAncestorOrSelfAxisIterator( contextNode ); } }
public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getPrecedingSiblingAxisIterator( contextNode ); } }
public boolean matches(Object node, ContextSupport support) { Navigator nav = support.getNavigator(); return nav.isText( node ); }
/** * Gets the iterator for the child axis. * * @param contextNode the current context node to work from * @param support the additional context information * @return an iterator over the children of the context node * @throws UnsupportedAxisException if the child axis is not supported */ public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getChildAxisIterator(contextNode); }
public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getDescendantOrSelfAxisIterator( contextNode ); } }
public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getDescendantAxisIterator( contextNode ); } }
/** * Gets an iterator for the attribute axis. * * @param contextNode the current context node to work from * @param support the additional context information */ public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getAttributeAxisIterator(contextNode); }
public boolean matches(Object node, ContextSupport contextSupport) { Navigator nav = contextSupport.getNavigator(); return nav.isComment( node ); }
public static void registerSelfInSimpleContext() { // see http://jaxen.org/extensions.html ((SimpleFunctionContext) XPathFunctionContext.getInstance()).registerFunction(null, "matches", new MatchesFunction()); }
/** @return true if the pattern matches the given node */ public boolean matches( Object node, Context context ) { short type = context.getNavigator().getNodeType( node ); return type == ELEMENT_NODE || type == TEXT_NODE || type == COMMENT_NODE || type == PROCESSING_INSTRUCTION_NODE; }