Package org.jaxen

Examples of org.jaxen.BaseXPath


    public void testid55676() throws JaxenException {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/defaultNamespace.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();
            /* NOTE: /a/b/c selects elements in no namespace only!
            */
 
View Full Code Here


    public void testid55692() throws JaxenException {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/defaultNamespace.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
        nsContext.addNamespace("dummy", "http://dummyNamespace/");
        getContextSupport().setNamespaceContext(nsContext);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
View Full Code Here

    public void testid55716() throws JaxenException {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/text.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(3, context, "/foo/bar/text()");
            assertValueOfXPath("baz", context, "normalize-space(/foo/bar/text())");
View Full Code Here

    public void testid55739() throws JaxenException {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/testNamespaces.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();
            /* the root is not an element, so no namespaces
            */
 
View Full Code Here

    public void testid55797() throws JaxenException {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/testNamespaces.xml";
        log("Document [" + url + "]");
        Object document = nav.getDocument(url);
        XPath contextpath = new BaseXPath("/Template/Application1", nav);
        log("Initial Context :: " + contextpath);
        List list = contextpath.selectNodes(document);
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Object context = iter.next();
            /* must count the default xml: prefix as well
            */
 
View Full Code Here

    public void testid55873() throws JaxenException {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/testNamespaces.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();
            /* namespace nodes have their element as their parent
            */
 
View Full Code Here

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

    protected Object assertCountXPath2(int expectedSize, Object context, String xpathStr)
            throws JaxenException {
        log(debug,
            "  Select :: " + xpathStr);
        BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());
        List results = xpath.selectNodes(getContext(context));
        log(debug,
            "    Expected Size :: " + expectedSize);
        log(debug,
            "    Result Size   :: " + results.size());
        if (expectedSize != results.size()) {
            log(debug,
                "      ## FAILED");
            log(debug,
                "      ## xpath: " + xpath + " = " + xpath.debug());
            Iterator resultIter = results.iterator();
            while (resultIter.hasNext()) {
                log(debug,
                    "      --> " + resultIter.next());
            }
View Full Code Here

    protected void assertInvalidXPath(Object context, String xpathStr) {
        try {
            log(debug,
                "  Select :: " + xpathStr);
            BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());
            List results = xpath.selectNodes(getContext(context));
            log(debug,
                "    Result Size   :: " + results.size());
            fail("An exception was expected.");
        }
        catch (UnsupportedAxisException e) {
View Full Code Here

    {
        Navigator nav = getNavigator();
        String url = TESTS_ROOT + "xml/numbers.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();
            /* repeated xpaths, jaxen-35
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.