Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.XmlCursor.toPrevToken()


        private int distanceToRoot()
        {
            XmlCursor cur = _impl.newCursor();
            int count = 0;
            while (!cur.toPrevToken().isNone())
            {
                if (!cur.currentTokenType().isNamespace())
                {
                    count += 1;
                    // System.out.println("Count: " + count + " " + cur.currentTokenType().toString() + " " + QName.pretty(cur.getName()));
View Full Code Here


        cursor.toFirstChild();

        XmlCursor cur = cursor.newCursor();

        // back up to previous start or end tag
        while (!isStartOrEnd(cur.toPrevToken())) { System.out.println("Backing up: at " + cur.currentTokenType()); }
        // then forward to first start or comment (may end up where we started)
        while (!isStartOrComment(cur.toNextToken())) { System.out.println("Advancing: at " + cur.currentTokenType()); }
        // then grab the "start" javelin annotation, and grab the start token and the first char
        // _firstToken = ((JavelinAnnotation)cur.getAnnotation(JavelinAnnotation.class)).getStartToken();
View Full Code Here

            Assert.assertTrue( cFrom.comparePosition( cTo ) == 0 );
            Assert.assertTrue( cFrom.isAtSamePositionAs( cTo ) );

            if (cFrom.toPrevChar( 1 ) == 1)
                cTo.toPrevChar( 1 );
            else if (cFrom.toPrevToken() != TokenType.NONE)
                cTo.toPrevToken();
            else
                break;
        }
View Full Code Here

        Assert.assertTrue( c.currentTokenType().isAttr() );
        Assert.assertTrue( c.toNextSibling() == true );
        Assert.assertTrue( c.getName().getLocalPart().equals( "x" ) );

        c.toEndDoc();
        c.toPrevToken();
        Assert.assertTrue( c.toPrevSibling() == true );
        Assert.assertTrue( c.getName().getLocalPart().equals( "z" ) );
        Assert.assertTrue( c.toPrevSibling() == true );
        Assert.assertTrue( c.getName().getLocalPart().equals( "y" ) );
        Assert.assertTrue( c.toPrevSibling() == true );
View Full Code Here

        Assert.assertTrue( c.toPrevSibling() == true );
        Assert.assertTrue( c.getName().getLocalPart().equals( "x" ) );
        Assert.assertTrue( c.toPrevSibling() == false );
       
        c.toEndDoc();
        c.toPrevToken();
        Assert.assertTrue( c.toParent() == true );
        Assert.assertTrue( c.getName().getLocalPart().equals( "a" ) );
       
        c.toEndDoc();
        Assert.assertTrue( c.toParent() == true );
View Full Code Here

        XmlCursor c = x.newCursor();

        c.toNextToken();
        c.insertElement( "foo", "http://p.com" );
        c.toPrevToken();
        c.insertNamespace( "p", "http://p.com" );

        Assert.assertTrue(
            x.xmlText().equals( "<p:foo xmlns:p=\"http://p.com\"/>" ) );
    }
View Full Code Here

        c.toNextToken();
        c.toNextToken();
       
        c.setBookmark( a2 );
       
        c.toPrevToken();
        c.toPrevToken();

        Assert.assertEquals( c.getBookmark( TestBookmark.class ), a1 );
       
        c.toNextToken();
View Full Code Here

        c.toNextToken();
       
        c.setBookmark( a2 );
       
        c.toPrevToken();
        c.toPrevToken();

        Assert.assertEquals( c.getBookmark( TestBookmark.class ), a1 );
       
        c.toNextToken();
        c.toNextToken();
View Full Code Here

        for ( int i = l.size() - 1 ; ; i-- )
        {
            // System.err.println(c.currentTokenType());
            Assert.assertEquals(l.get(i), c.currentTokenType());

            if (c.toPrevToken() == TokenType.NONE)
                break;
        }
    }

    //
View Full Code Here

        c.pop();
        c.push();
       
        while ( !(c.isContainer() || c.isAttr()) )
            if (c.toPrevToken().isNone())
                break;

        XmlObject x = c.getObject();
        c.pop();
        if (x == null)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.