Package org.jaxen

Examples of org.jaxen.Navigator


   
    /** @return true if the pattern matches the given node
      */
    public boolean matches( Object node, Context context ) throws JaxenException
    {
        Navigator navigator = context.getNavigator();

/*       
        if ( isAbsolute() )
        {
            node = navigator.getDocumentNode( node );
        }
*/
        if (! nodeTest.matches(node, context) )
        {
            return false;
        }
       
        if (parentPattern != null)
        {
            Object parent = navigator.getParentNode( node );
            if ( parent == null )
            {
                return false;
            }
            if ( ! parentPattern.matches( parent, context ) )
            {
                return false;
            }
        }

        if (ancestorPattern != null) {
            Object ancestor = navigator.getParentNode( node );
            while (true)
            {
                if ( ancestorPattern.matches( ancestor, context ) )
                {
                    break;
                }
                if ( ancestor == null )
                {
                    return false;
                }
                if ( navigator.isDocument( ancestor ) )
                {
                    return false;
                }
                ancestor = navigator.getParentNode( ancestor );
            }
        }
       
        if (filters != null)
        {
View Full Code Here


    }

    public boolean matches(Object node,
                           ContextSupport contextSupport)
    {
        Navigator nav = contextSupport.getNavigator();

        return nav.isComment( node );
    }
View Full Code Here

{

    public Object call(Context context,
                       List args) throws FunctionCallException
    {
        Navigator navigator = context.getNavigator();
        int size = args.size();
        if (size > 0)
        {
            Object text = args.get(0);
            Locale locale = null;
View Full Code Here

    }

    public boolean matches(Object node,
                           ContextSupport support)
    {
        Navigator nav = support.getNavigator();

        return nav.isText( node );
    }
View Full Code Here

    public Object call(Context context,
                       List args) throws FunctionCallException
    {
        if (args.size() == 1)
        {
            Navigator nav = context.getNavigator();

            String    url = StringFunction.evaluate( args.get( 0 ),
                                                     nav );

            return evaluate( url,
View Full Code Here

    }

    public boolean matches(Object node,
                           ContextSupport support)
    {
        Navigator nav = support.getNavigator();

        boolean isPi = nav.isProcessingInstruction( node );

        if ( isPi )
        {
            String name = getName();

            if ( name == null || "".equals( name ) )
            {
                return true;
            }
            else
            {
                return name.equals( nav.getProcessingInstructionTarget( node ) );
            }
        }

        return false;
    }
View Full Code Here

       
        if (contextNodes.size() == 0)
            return Collections.EMPTY_LIST;
     
        Object contextNode = contextNodes.get(0);
        Navigator nav = context.getNavigator();

        String xpathString;
        if ( arg instanceof String )
            xpathString = (String)arg;
        else
            xpathString = StringFunction.evaluate(arg, nav);

        try {
            XPath xpath = nav.parseXPath(xpathString);
            ContextSupport support = context.getContextSupport();
            xpath.setVariableContext( support.getVariableContext() );
            xpath.setFunctionContext( support.getFunctionContext() );
            xpath.setNamespaceContext( support.getNamespaceContext() );
            return xpath.selectNodes( context.duplicate() );
View Full Code Here

public class UpperFunction extends LocaleFunctionSupport
{
    public Object call(Context context,
                       List args) throws FunctionCallException
    {
        Navigator navigator = context.getNavigator();
        int size = args.size();
        if (size > 0)
        {
            Object text = args.get(0);
            Locale locale = null;
View Full Code Here

            log.warn("Synapse context has not been set for the XPath extension function" +
                "'synapse:get-property(prop-name)'");
            return null;

        } else {
            Navigator navigator = context.getNavigator();
            Iterator iter = args.iterator();
            while (iter.hasNext()) {
                String key = StringFunction.evaluate(iter.next(), navigator);
                // ignore if more than one argument has been specified
                Object result = synCtx.getProperty(key);
View Full Code Here

        }
    }

    public void testid53463() throws JaxenException
    {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/simple.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/root/c", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext())
View Full Code Here

TOP

Related Classes of org.jaxen.Navigator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.