Package org.jaxen

Examples of org.jaxen.BaseXPath


    {
        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())
        {
            Object context = iter.next();
            assertValueOfXPath("d", context, "string()");
View Full Code Here


    {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/jaxen3.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext())
        {
            Object context = iter.next();
            assertCountXPath(1, context, "/Configuration/hostname/attrlist/hostname[. = 'CE-A'] ");
View Full Code Here

     * @throws SAXPathException if the string is not a syntactically
     *                          correct XPath expression
     * @see XPath
     */
    public XPath parseXPath(String xpath) throws SAXPathException {
        return new BaseXPath(xpath, this);
    }
View Full Code Here

     * @throws SAXPathException if the string is not a syntactically
     *                          correct XPath expression
     * @see XPath
     */
    public XPath parseXPath(String xpath) throws SAXPathException {
        return new BaseXPath(xpath, this);
    }
View Full Code Here

     * @return Returns a new XPath expression object.
     * @throws SAXPathException if the string is not a syntactically correct XPath expression
     * @see XPath
     */
    public XPath parseXPath(String xpath) throws SAXPathException {
        return new BaseXPath(xpath, this);
    }
View Full Code Here

    }

    protected void assertValueOfXPath(String expected, Object context, String xpathStr)
            throws JaxenException {
        try {
            BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());
            Object node = xpath.evaluate(getContext(context));
            String result = StringFunction.evaluate(node,
                                                    getNavigator());
            log(debug,
                "  Select :: " + xpathStr);
            log(debug,
                "    Expected :: " + expected);
            log(debug,
                "    Result   :: " + result);
            if (!expected.equals(result)) {
                log(debug,
                    "      ## FAILED");
                log(debug,
                    "      ## xpath: " + xpath + " = " + xpath.debug());
            }
            assertEquals(xpathStr,
                         expected,
                         result);
        }
View Full Code Here

    public void testid53371() throws JaxenException {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/jaxen24.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/body/div", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            assertCountXPath(1, context, "preceding::*[1]");
            assertValueOfXPath("span", context, "local-name(preceding::*[1])");
 
View Full Code Here

    public void testid53391() throws JaxenException {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/jaxen24.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            assertCountXPath(0, context, "//preceding::x");
            assertCountXPath(0, context, "//following::x");
View Full Code Here

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

    public void testid53441() 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", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            assertValueOfXPath("abd", context, "string()");
        }
View Full Code Here

TOP

Related Classes of org.jaxen.BaseXPath

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.