javax.xml.xpath.XPathFunction Java Examples
The following examples show how to use
javax.xml.xpath.XPathFunction.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XmlFileFunctionResolver.java From windup with Eclipse Public License 1.0 | 6 votes |
@Override public XPathFunction resolveFunction(final QName functionName, final int arity) { if (functionMap.containsKey(functionName)) { return new XPathFunction() { @Override public Object evaluate(List args) throws XPathFunctionException { return functionMap.get(functionName).evaluate(args); } }; } return originalResolver.resolveFunction(functionName, arity); }
Example #2
Source File: JAXPExtensionsProvider.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #3
Source File: JAXPExtensionsProvider.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #4
Source File: JAXPExtensionsProvider.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #5
Source File: JAXPExtensionsProvider.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #6
Source File: XPathParser.java From jlibs with Apache License 2.0 | 6 votes |
@Override public void endFunction() throws SAXPathException{ ArrayDeque params = popFrame(); javax.xml.namespace.QName name = (javax.xml.namespace.QName)params.pollFirst(); if(name.getNamespaceURI().length()==0) push(createFunction(name.getLocalPart(), params).simplify()); else{ int noOfParams = params.size(); XPathFunction function = functionResolver.resolveFunction(name, noOfParams); if(function==null) throw new SAXPathException("Unknown Function: "+name); FunctionCall functionCall = new FunctionCall(new Functions.UserFunction(name.getNamespaceURI(), name.getLocalPart(), function), noOfParams); for(int i=0; i<noOfParams; i++) functionCall.addMember(params.pollFirst(), i); push(functionCall); } }
Example #7
Source File: JAXPExtensionsProvider.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #8
Source File: JAXPExtensionsProvider.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #9
Source File: JAXPExtensionsProvider.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #10
Source File: JAXPExtensionsProvider.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #11
Source File: JAXPExtensionsProvider.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #12
Source File: JAXPExtensionsProvider.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #13
Source File: JAXPExtensionsProvider.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #14
Source File: JAXPExtensionsProvider.java From j2objc with Apache License 2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #15
Source File: MapBasedXPathFunctionResolver.java From ph-commons with Apache License 2.0 | 5 votes |
/** * Add all functions from the other function resolver into this resolver. * * @param aOther * The function resolver to import the functions from. May not be * <code>null</code>. * @param bOverwrite * if <code>true</code> existing functions will be overwritten with the * new functions, otherwise the old functions are kept. * @return {@link EChange} */ @Nonnull public EChange addAllFrom (@Nonnull final MapBasedXPathFunctionResolver aOther, final boolean bOverwrite) { ValueEnforcer.notNull (aOther, "Other"); EChange eChange = EChange.UNCHANGED; for (final Map.Entry <XPathFunctionKey, XPathFunction> aEntry : aOther.m_aMap.entrySet ()) if (bOverwrite || !m_aMap.containsKey (aEntry.getKey ())) { m_aMap.put (aEntry.getKey (), aEntry.getValue ()); eChange = EChange.CHANGED; } return eChange; }
Example #16
Source File: TestFunctionResolver.java From jlibs with Apache License 2.0 | 5 votes |
@Override public XPathFunction resolveFunction(QName functionName, int arity) { if(functionName.equals(new QName("http://jlibs.googlecode.com", "reverse"))) return REVERSE; else return null; }
Example #17
Source File: MapBasedXPathFunctionResolver.java From ph-commons with Apache License 2.0 | 5 votes |
/** * Add a new function. * * @param aName * The qualified name of the function * @param nArity * The number of parameters of the function * @param aFunction * The function to be used. May not be <code>null</code>. * @return {@link EChange} */ @Nonnull public EChange addUniqueFunction (@Nonnull final QName aName, @Nonnegative final int nArity, @Nonnull final XPathFunction aFunction) { ValueEnforcer.notNull (aFunction, "Function"); final XPathFunctionKey aFunctionKey = new XPathFunctionKey (aName, nArity); if (m_aMap.containsKey (aFunctionKey)) return EChange.UNCHANGED; m_aMap.put (aFunctionKey, aFunction); return EChange.CHANGED; }
Example #18
Source File: MapBasedXPathFunctionResolver.java From ph-commons with Apache License 2.0 | 5 votes |
/** * @return A mutable copy of all contained functions. Never <code>null</code> * but maybe empty. */ @Nonnull @ReturnsMutableCopy public ICommonsOrderedMap <XPathFunctionKey, XPathFunction> getAllFunctions () { return m_aMap.getClone (); }
Example #19
Source File: Functions.java From jlibs with Apache License 2.0 | 4 votes |
public UserFunction(String namespace, String name, XPathFunction xpathFunction){ super(namespace, name, DataType.PRIMITIVE, true, DataType.PRIMITIVE); this.xpathFunction = xpathFunction; }
Example #20
Source File: XPathExFuncTest.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public XPathFunction resolveFunction(QName functionName, int arity) { // not a real ewsolver, always return a default XPathFunction return new MyXPathFunction(); }
Example #21
Source File: MapBasedXPathFunctionResolver.java From ph-commons with Apache License 2.0 | 4 votes |
@Nullable public XPathFunction resolveFunction (@Nonnull final QName aFunctionName, @Nonnegative final int nArity) { return resolveFunction (new XPathFunctionKey (aFunctionName, nArity)); }
Example #22
Source File: MapBasedXPathFunctionResolver.java From ph-commons with Apache License 2.0 | 4 votes |
@Nullable public XPathFunction resolveFunction (@Nullable final XPathFunctionKey aFunctionKey) { return m_aMap.get (aFunctionKey); }
Example #23
Source File: XmlFileFunctionResolver.java From windup with Eclipse Public License 1.0 | 4 votes |
public void registerFunction(String namespaceURI, String functionName, XPathFunction function) { QName qname = new QName(namespaceURI, functionName); functionMap.put(qname, function); }
Example #24
Source File: XPathExFuncTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public XPathFunction resolveFunction(QName functionName, int arity) { // not a real ewsolver, always return a default XPathFunction return new MyXPathFunction(); }
Example #25
Source File: XPathExFuncTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public XPathFunction resolveFunction(QName functionName, int arity) { // not a real ewsolver, always return a default XPathFunction return new MyXPathFunction(); }
Example #26
Source File: XPathExFuncTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public XPathFunction resolveFunction(QName functionName, int arity) { // not a real ewsolver, always return a default XPathFunction return new MyXPathFunction(); }
Example #27
Source File: XPathExFuncTest.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public XPathFunction resolveFunction(QName functionName, int arity) { // not a real ewsolver, always return a default XPathFunction return new MyXPathFunction(); }
Example #28
Source File: XPathExFuncTest.java From hottub with GNU General Public License v2.0 | 4 votes |
public XPathFunction resolveFunction(QName functionName, int arity) { // not a real ewsolver, always return a default XPathFunction return new MyXPathFunction(); }
Example #29
Source File: XPathExFuncTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public XPathFunction resolveFunction(QName functionName, int arity) { // not a real ewsolver, always return a default XPathFunction return new MyXPathFunction(); }
Example #30
Source File: SecureProcessingTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public XPathFunction resolveFunction(QName functionName, int arity) { // not a real ewsolver, always return a default XPathFunction return new MyXPathFunction(); }