getCurrentIndex2() protected method

protected getCurrentIndex2 ( ) : int
return int
Example #1
0
        private int process_self(VTDNav vn)
        {
            bool b1 = false;
            Predicate t = null;
            int result;
            switch (state)
            {
                case START:
                case FORWARD:
                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                        else
                            state = END;
                        break;
                    }
                    if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                    {
                        if (currentStep.nextS != null)
                        {
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        }
                        else
                        {
                            state = TERMINAL;
                            if (vn.atTerminal)
                                result = vn.LN;
                            else
                                result = vn.getCurrentIndex2();
                            if (isUnique(result))
                                return result;
                        }
                    }
                    else
                    {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if (state == START)
                            state = END;
                        else
                            state = BACKWARD;
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                case TERMINAL:
                    if (currentStep.prevS != null)
                    {
                        state = BACKWARD;
                        currentStep = currentStep.prevS;
                    }
                    else
                    {
                        state = END;
                    }
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
Example #2
0
        protected internal int process_ancestor2( VTDNav vn)
        {
            int result;
            bool b = false, b1 = false;
            //int contextSize;
            Predicate t= null;

            switch(state){
            case START:

                t = currentStep.p;
                while (t != null) {
                    if (t.requireContext) {
                        int i = computeContextSize( t, vn);
                        if (i == 0) {
                            b1 = true;
                            break;
                        } else
                            t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1) {
                    state = END;
                    break;
                }

                state = END;
                //if (vn.getCurrentDepth() != -1) {
                    vn.push2();

                    while (vn.toNode(VTDNav.P)) {
                        if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                            if (currentStep.nextS != null) {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                break;
                            } else {
                                //vn.pop();
                                state = TERMINAL;
                                result = vn.getCurrentIndex2();
                                if (isUnique(result))
                                    return result;
                            }
                        }
                    }
                    if (state == END) {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                    }
               // }
                break;

            case END:
                currentStep =null;
                // reset();
                return -1;

            case FORWARD:
                 t = currentStep.p;
                 while(t!=null){
                    if (t.requireContext){
                         int i = computeContextSize(t,vn);
                         if (i==0){
                             b1 = true;
                             break;
                         }else
                             t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1){
                    currentStep = currentStep.prevS;
                    state = BACKWARD;
                    break;
                }
                state =  BACKWARD;
               	vn.push2();

               	while(vn.toNode(VTDNav.P)){
               		if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
               				&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
               			if (currentStep.nextS != null){
               				 state =  FORWARD;
               				currentStep = currentStep.nextS;
               				break;
               			}
               			else {
               				//vn.pop();
               				 state =  TERMINAL;
               				result = vn.getCurrentIndex2();
                            if ( isUnique(result))
                                return result;
               			}
               		}
               	}
               	if ( state == BACKWARD){
                    if (currentStep.hasPredicate)
                        currentStep.resetP(vn);
                    vn.pop2();
               		currentStep=currentStep.prevS;
               	}
              	break;

            case BACKWARD:
                b = false;
                    //vn.push2();
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_ancestor(vn);
                        break;
                    }
                    while (vn.toNode(VTDNav.P)) {
                    if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                        if (currentStep.nextS!= null) {
                             state =  FORWARD;
                            currentStep = currentStep.nextS;
                            b = true;
                            break;
                        } else {
                            //vn.pop();
                             state =  TERMINAL;
                            result = vn.getCurrentIndex2();
                            if ( isUnique(result))
                                return result;
                        }
                    }
                }
                if (b==false){
                        currentStep.out_of_range = false;
                        transition_ancestor(vn);
                    }
                break;

            case TERMINAL:

                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_ancestor(vn);
                        break;
                    }
                    while (vn.toNode(VTDNav.P)) {
                if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                        && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                    result = vn.getCurrentIndex2();
                    if ( isUnique(result))
                        return result;
                }
            }

               currentStep.out_of_range = false;
                    transition_ancestor(vn);
                    break;

            default:
            throw new  XPathEvalException("unknown state");
            }
            return -2;
        }
Example #3
0
        private int process_DDFP(VTDNav vn)
        {
            AutoPilot ap;
            bool b = false, b1 = false;
            Predicate t = null;
            int result;

            switch (state)
            {
                case START:
                case FORWARD:

                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == START)
                            state = END;
                        else
                        {
                            currentStep = currentStep.prevS;
                            state = BACKWARD;
                        }
                        break;
                    }

                    String helper = null;
                    if (currentStep.nt.testType == NodeTest.NAMETEST)
                    {
                        helper = currentStep.nt.nodeName;
                    }
                    else if (currentStep.nt.testType == NodeTest.NODE)
                    {
                        helper = "*";
                    }
                    else
                        throw new XPathEvalException("can't run descendant "
                                + "following, or following-sibling axis over comment(), pi(), and text()");
                    if (currentStep.o == null)
                        currentStep.o = ap = new AutoPilot(vn);
                    else
                    {
                        ap = (AutoPilot)currentStep.o;
                        ap.bind(vn);
                    }
                    if (currentStep.ft)
                    {
                        if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0)
                            if (currentStep.nt.testType == NodeTest.NODE || helper.Equals("*"))
                                ap.Special=(true);
                            else
                                ap.Special=(false);
                        //currentStep.o = ap = new AutoPilot(vn);
                        if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0)
                            ap.selectElement(helper);
                        else if (currentStep.axis_type == AxisType.DESCENDANT0)
                            ap.selectElement_D(helper);
                        else if (currentStep.axis_type == AxisType.PRECEDING0)
                            ap.selectElement_P(helper);
                        else
                            ap.selectElement_F(helper);
                        currentStep.ft = false;
                    }
                    if (state == START)
                        state = END;

                    vn.push2(); // not the most efficient. good for now
                    //System.out.println("  --++ push in //");
                    b = false;
                    while (ap.iterate())
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            b = true;
                            break;
                        }
                    }
                    if (b == false)
                    {
                        vn.pop2();
                        //System.out.println("  --++ pop in //");
                        currentStep.ft = true;
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                    }
                    else
                    {
                        if (currentStep.nextS != null)
                        {
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        }
                        else
                        {
                            //vn.pop();
                            state = TERMINAL;
                            result = vn.getCurrentIndex2();
                            if (isUnique(result))
                                return result;
                        }
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                    //currentStep = currentStep.prevS;
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                        break;
                    }
                    ap = (AutoPilot)currentStep.o;
                    //vn.push();
                    //b = false;
                    while (ap.iterate())
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            b = true;
                            break;
                        }
                    }
                    if (b)
                    {
                        //if (currentStep.nextS != null)
                        //{
                            //vn.push();
                            //System.out.println("  --++ push in //");
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        //}
                        //else
                        //{
                        //    state = TERMINAL;
                        //    result = vn.getCurrentIndex();
                        //    if (isUnique(result))
                        //        return result;
                        //}
                    }
                    else
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                    }
                    break;

                case TERMINAL:
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                        break;
                    }
                    ap = (AutoPilot)currentStep.o;
                    b = false;
                    while (ap.iterate())
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            b = true;
                            break;
                        }
                    }
                    if (b)
                    {
                        //if (currentStep.evalPredicates(vn)) {
                        result = vn.getCurrentIndex2();
                        if (isUnique(result))
                            return result;
                        //}
                    }
                    else
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                    }
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
Example #4
0
        private int process_preceding_sibling(VTDNav vn)
        {
            bool b = false, b1 = false;
            Predicate t = null;
            int result;
            switch (state)
            {
                case START:
                case FORWARD:
                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                        else
                            state = END;
                        break;
                    }
                    if (state == START)
                        state = END;
                    else
                        state = BACKWARD;
                    vn.push2();
                    while (vn.toElement(VTDNav.PS))
                    {
                        if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                        {
                            if (currentStep.nextS != null)
                            {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                break;
                            }
                            else
                            {
                                state = TERMINAL;
                                result = vn.getCurrentIndex2();
                                if (isUnique(result))
                                    return result;
                            }
                        }
                    }
                    if(state == END)  {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                    }else if (state == BACKWARD)
                    {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                        currentStep = currentStep.prevS;
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_preceding_sibling(vn);
                        break;
                    }
                    while (vn.toElement(VTDNav.PS))
                    {
                        if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                        {
                            if (currentStep.nextS != null)
                            {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                b = true;
                                break;
                            }
                            else
                            {
                                state = TERMINAL;
                                result = vn.getCurrentIndex2();
                                if (isUnique(result))
                                    return result;
                            }
                        }
                    }
                    if (b == false)
                    {
                        currentStep.out_of_range = false;
                        transition_preceding_sibling(vn);
                    }
                    break;

                case TERMINAL:
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_preceding_sibling(vn);
                        break;
                    }
                    while (vn.toElement(VTDNav.PS))
                    {
                        if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                        {
                            // state =  TERMINAL;
                            result = vn.getCurrentIndex2();
                            if (isUnique(result))
                                return result;
                        }
                    }
                    currentStep.out_of_range = false;
                    transition_preceding_sibling(vn);
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
Example #5
0
        private int process_child(VTDNav vn)
        {
            int result;
            bool b = false, b1 = false;
            int k=1;
            Predicate t= null;
               // Console.WriteLine(" index-============= " + vn.getCurrentIndex());
               // Console.WriteLine(" depth ==============" + vn.getCurrentDepth());
            switch(state){
                case START:
                    //if (currentStep.nt.testType < NodeTest.TEXT){
                        // first search for any predicate that
                        // requires contextSize
                        // if so, compute its context size
                        // if size > 0
                        // set context
                        // if size ==0
                        // immediately set the state to backward or end
                        t = currentStep.p;
                        while(t!=null){
                            if (t.requireContext){
                                int i = computeContextSize(t,vn);
                                if (i==0){
                                    b1 = true;
                                    break;
                                }else
                                    t.ContextSize=(i);
                            }
                            t = t.nextP;
                        }
                        if (b1){
                            state = END;
                            break;
                        }

                         b=vn.toElement(VTDNav.FIRST_CHILD);
                         state =  END;
                         if (b ){
                         do {
                            if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                    && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                if (currentStep.nextS != null){
                                    //currentStep.position++;
                                    state =  FORWARD;
                                    currentStep = currentStep.nextS;
                                }
                                else {
                                    state =  TERMINAL;
                                    result = vn.getCurrentIndex2();
                                    if ( isUnique(result)){
                                        return result;
                                    }
                                }
                            break;
                            }
                        } while (vn.toElement(VTDNav.NS));
                        if (state == END)
                            vn.toElement(VTDNav.PARENT);
                     }

                    break;
                case END:
                    currentStep =null;
                    // reset();
                    return -1;

                case FORWARD:
                    //if (currentStep.nt.testType < NodeTest.TEXT){
                        t = currentStep.p;
                        while(t!=null){
                            if (t.requireContext){
                                int i = computeContextSize(t,vn);
                                if (i==0){
                                    b1 = true;
                                    break;
                                }else
                                    t.ContextSize=(i);
                            }
                            t = t.nextP;
                        }
                        if (b1){
                            currentStep = currentStep.prevS;
                            state = BACKWARD;
                            break;
                        }

               			 	state =  BACKWARD;
               			 	if (vn.toElement(VTDNav.FC)) {
                            do {
                                if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                        && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                    if (currentStep.nextS != null) {
                                         state =  FORWARD;
                                        currentStep = currentStep.nextS;
                                    } else {
                                         state =  TERMINAL;
                                        result = vn.getCurrentIndex2();
                                        if ( isUnique(result))
                                            return result;
                                    }
                                    goto forward;
                                }

                            } while (vn.toElement(VTDNav.NS));
                            vn.toElement(VTDNav.P);
                            if (currentStep.hasPredicate)
                                currentStep.resetP(vn);
                            currentStep = currentStep.prevS;
                        } else {
                            //vn.toElement(VTDNav.P);
                            currentStep = currentStep.prevS;
                        }
                    forward:

                    break;

                case BACKWARD:
                    //if (currentStep.nt.testType < NodeTest.TEXT) {
                        //currentStep = currentStep.prevS;
                        //b = false;
                        if(currentStep.out_of_range){
                            currentStep.out_of_range = false;
                            transition_child(vn);
                            break;
                        }
                        while (vn.toElement(VTDNav.NS)) {
                            if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                    && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                b = true;
                                break;
                            }
                        }
                        if (b ) {
                            state =  FORWARD;
                            currentStep = currentStep.nextS;
                        } else {
                        currentStep.out_of_range = false;
                        transition_child(vn);
                        }
                    break;

                case TERMINAL:
                        if(currentStep.out_of_range){
                            currentStep.out_of_range = false;
                            transition_child(vn);
                            break;
                        }
                    //if (currentStep.nt.testType < NodeTest.TEXT) {
                        while (vn.toElement(VTDNav.NS)) {
                            if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                    && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                // state =  TERMINAL;
                                result = vn.getCurrentIndex2();
                                if ( isUnique(result))
                                    return result;
                            }
                        }
                    currentStep.out_of_range = false;
                    transition_child(vn);
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
Example #6
0
        protected internal int process_parent2(VTDNav vn)
        {
            bool b1 = false;
            Predicate t= null;
            int result;
            switch ( state) {
            case  START:
            case  FORWARD:
                t = currentStep.p;
                while(t!=null){
                    if (t.requireContext){
                        int i = computeContextSize(t,vn);
                        if (i==0){
                            b1 = true;
                            break;
                        }else
                            t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1){
                    if (state == FORWARD){
                        state = BACKWARD;
                        currentStep = currentStep.prevS;
                    }else
                        state = END;
                    break;
                }

                if (vn.getCurrentDepth() == -1) {
                    if ( state ==  START)
                         state =  END;
                    else {
                        //vn.pop();
                         state =  BACKWARD;
                        currentStep = currentStep.prevS;
                    }
                } else {
                    vn.push2();
                    vn.toNode(VTDNav.P); // must return true
                    if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
                        if (currentStep.nextS != null) {
                            state =  FORWARD;
                           currentStep = currentStep.nextS;
                        } else {
                            state =  TERMINAL;
                           result = vn.getCurrentIndex2();
                            if ( isUnique(result))
                                return result;
                        }
                    }else{
                        vn.pop2();
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if ( state ==  START)
                             state =  END;
                        else {
                             state =  BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                    }
                }

                break;

            case  END:
                currentStep = null;
                // reset();
                return -1;

            case  BACKWARD:
            case  TERMINAL:
                if (currentStep.prevS == null) {
                    vn.pop2();
                     state =  END;
                    break;
                }else {
                    vn.pop2();
                     state =  BACKWARD;
                    currentStep = currentStep.prevS;
                    break;
                }

            default:
                throw new  XPathEvalException("unknown state");

            }
            return -2;
        }
Example #7
0
        public override int evalNodeSet(VTDNav vn)
        {
            switch (opCode)
            {
                case FuncName.CURRENT:
                    if (state == START)
                    {
                        vn.loadCurrentNode();
                        state = END;
                        return vn.getCurrentIndex2();
                    }
                    else
                    {
                        return -1;
                    }
                // break;
                case FuncName.DOCUMENT:
                    if (argCount1 == 1)
                    {
                        if (!argumentList.e.NodeSet)
                        {
                            if (state == START)
                            {
                                String s = argumentList.e.evalString(vn);
                                if (s.Length == 0)
                                {
                                    newVN = xslVN;
                                    newVN.context[0] = -1;
                                }
                                else if (vg.parseFile(s, true))
                                {
                                    newVN = vg.getNav();
                                    newVN.context[0] = -1;
                                    newVN.URIName = s;
                                }
                                else
                                {
                                    state = END;
                                    return -1;
                                }
                                state = END;
                                return 0;
                            }
                            else
                            {
                                return -1;
                            }
                        }
                        else
                        {
                            try
                            {
                                if (state != END)
                                {
                                    a = argumentList.e.evalNodeSet(vn);
                                    if (a != -1)
                                    {
                                        String s = vn.toString(getStringVal(vn, a));
                                        if (s.Length == 0)
                                        {
                                            newVN = xslVN;
                                            newVN.context[0] = -1;
                                        }
                                        else if (vg.parseFile(s, true))
                                        {
                                            newVN = vg.getNav();
                                            newVN.context[0] = -1;
                                            newVN.URIName = s;
                                        }
                                        else
                                        {
                                            state = END;
                                            return -1;
                                        }
                                        state = END;
                                        return 0;
                                    }
                                    else
                                    {
                                        state = END;
                                        return -1;
                                    }
                                }
                                else
                                    return -1;
                            }
                            catch (NavException e)
                            {

                            }
                        }
                    }

                    break;
                case FuncName.KEY:
                    throw new XPathEvalException(" key() not yet implemented ");
                // break;
            }
            throw new XPathEvalException(" Function Expr can't eval to node set ");
        }
Example #8
0
        /**
         * generate-id(nodeset?);
         * @param vn
         * @return
         */
        private String generateID(VTDNav vn)
        {
            if (argCount1 == 0)
            {
                return "v" + vn.getCurrentIndex2();
            }
            else if (argCount1 == 1)
            {
                int i = evalFirstArgumentListNodeSet2(vn);
                return "v" + i;
            }
            else
                throw new ArgumentException
                ("generate-id()'s argument count is invalid");

        }
Example #9
0
        private int getStringLen(VTDNav vn)
        {
            if (argCount1 == 0)
            {
                try
                {
                    if (vn.atTerminal == true)
                    {
                        int type = vn.getTokenType(vn.LN);
                        if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS)
                        {
                            return vn.getStringLength(vn.LN + 1);
                        }
                        else
                        {
                            return vn.getStringLength(vn.LN);
                        }
                    }
                    else
                    {
                        int k = vn.getCurrentIndex2();
                        // int type = vn.getTokenType(k);
                        return vn.XPathStringLength(k);
                    }
                }
                catch (NavException e)
                {
                    return 0;
                }
            }
            else if (argCount1 == 1)
            {
                int result = 0;
                if (argumentList.e.NodeSet)
                {
                    int a = 0x7fffffff, k = -1;
                    vn.push2();
                    int size = vn.contextStack2.size;
                    try
                    {
                        if (argumentList.e.needReordering)
                        {
                            argumentList.e.adjust(vn.getTokenCount());
                            while ((k = argumentList.e.evalNodeSet(vn)) != -1)
                            {
                                if (k < a)
                                    a = k; // a is always smaller
                            }
                            if (a == 0x7fffffff)
                            {
                                a = -1;
                            }
                        }
                        else
                        {
                            a = argumentList.e.evalNodeSet(vn);
                        }
                        if (a == -1)
                            result = 0;
                        else
                        {

                            int type = vn.getTokenType(a);
                            if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS || type == VTDNav.TOKEN_PI_NAME)
                            {
                                result = vn.getStringLength(a + 1);
                            }
                            else if (type == VTDNav.TOKEN_STARTING_TAG || type == VTDNav.TOKEN_DOCUMENT)
                            {
                                result = vn.XPathStringLength(a);
                            }
                            else
                            {
                                result = vn.getStringLength(a);
                            }
                        }
                    }
                    catch (VTDException e)
                    {

                    }
                    argumentList.e.reset(vn);
                    vn.contextStack2.size = size;
                    vn.pop2();
                    return result;
                }
                else
                    return argumentList.e.evalString(vn).Length;
            }
            else
            {
                throw new System.ArgumentException("string-length()'s argument count is invalid");
            }
        }