Class JXPathUtils


  • public class JXPathUtils
    extends Object
    Contains utility methods to create safe JXPathContext objects.
    • Constructor Detail

      • JXPathUtils

        public JXPathUtils()
    • Method Detail

      • newSafeContext

        public static JXPathContext newSafeContext​(Object contextBean,
                                                   boolean lenient)
        Creates a JXPathContext that disables calling Java methods from XPath expressions.
        Parameters:
        contextBean - the root node object
        lenient - whether the context is in lenient mode
        Returns:
        the context
      • newSafeContext

        public static JXPathContext newSafeContext​(Object contextBean,
                                                   boolean lenient,
                                                   NamespaceSupport ns,
                                                   boolean declared)
        Creates a JXPathContext that disables calling Java methods from XPath expressions.
        Parameters:
        contextBean - the root node object
        lenient - whether the context is in lenient mode
        ns - the namespaces
        declared - true to include all declared prefixes; false for all active prefixes
        Returns:
        the context