getXPathStringVal() protected method

protected getXPathStringVal ( ) : String
return String
Example #1
0
        public override double evalNumber(VTDNav vn)
        {
            double d = Double.NaN;
            int a = -1;
            vn.push2();
            int size = vn.contextStack2.size;
            try
            {
                a = evalNodeSet(vn);
                if (a != -1)
                {
                    int t = vn.getTokenType(a);
                    if (t == VTDNav.TOKEN_ATTR_NAME)
                    {
                        d = vn.parseDouble(a + 1);
                    }
                    else if (t == VTDNav.TOKEN_STARTING_TAG || t == VTDNav.TOKEN_DOCUMENT)
                    {
                        String s = vn.getXPathStringVal();
                        d = Double.Parse(s);
                    }
                    else if (t == VTDNav.TOKEN_PI_NAME)
                    {
                        if (a + 1 < vn.vtdSize || vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL)
                            d = vn.parseDouble(a + 1);
                    }
                    else
                        d = vn.parseDouble(a);
                }
            }
            catch (Exception e)
            {

            }
            vn.contextStack2.size = size;
            reset(vn);
            vn.pop2();
            //return s;
            return d;
        }
Example #2
0
        /*
        * (non-Javadoc)
        *
        * @see com.ximpleware.xpath.Expr#evalString(com.ximpleware.VTDNav)
        */
        public override System.String evalString(VTDNav vn)
        {
            if (e.NodeSet == false)
                return e.evalString(vn);
            else
            {
                String s = "";
                int a = -1;
                vn.push2();
                int size = vn.contextStack2.size;
                try
                {
                    a = evalNodeSet(vn);
                    if (a != -1)
                    {
                        int t = vn.getTokenType(a);
                        switch (t)
                        {
                            case VTDNav.TOKEN_STARTING_TAG:
                            case VTDNav.TOKEN_DOCUMENT:
                                s = vn.getXPathStringVal();
                                break;
                            case VTDNav.TOKEN_ATTR_NAME:
                                s = vn.toString(a + 1);
                                break;
                            case VTDNav.TOKEN_PI_NAME:
                                //if (a + 1 < vn.vtdSize
                                //        || vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL)
                                s = vn.toString(a + 1);
                                break;
                            default:
                                s = vn.toString(a);
                                break;
                        }
                        /*if (t == VTDNav.TOKEN_ATTR_NAME) {
                            s = vn.toString(a + 1);
                        } else if (t == VTDNav.TOKEN_STARTING_TAG
                                || t == VTDNav.TOKEN_DOCUMENT) {
                            s = vn.getXPathStringVal();
                        } else if (t == VTDNav.TOKEN_PI_NAME) {
                            if (a + 1 < vn.vtdSize
                                    || vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL)
                                s = vn.toString(a + 1);
                            // s = vn.toString(a+1);
                        } else
                            s = vn.toString(a);*/
                    }
                }
                catch (Exception ee)
                {

                }
                vn.contextStack2.size = size;
                reset(vn);
                vn.pop2();
                return s;
            }
        }
Example #3
0
 private String getString(VTDNav vn)
 {
     if (argCount1 == 0)
         try
         {
             if (vn.atTerminal)
             {
                 if (vn.getTokenType(vn.LN) == VTDNav.TOKEN_CDATA_VAL)
                     return vn.toRawString(vn.LN);
                 return vn.toString(vn.LN);
             }
             return vn.getXPathStringVal();
         }
         catch (NavException e)
         {
             return null; // this will almost never occur
         }
     else if (argCount1 == 1)
     {
         return argumentList.e.evalString(vn);
     }
     else
         throw new System.ArgumentException("String()'s argument count is invalid");
 }
Example #4
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="vn"></param>
		/// <returns></returns>
		public override System.String evalString(VTDNav vn)
		{
            String s = "";
            int a = 0x7fffffff, k = -1;
            vn.push2();
            int size = vn.contextStack2.size;
            try
            {
                while ((k = evalNodeSet(vn)) != -1)
                {
                    //a = evalNodeSet(vn);
                    if (k < a)
                        a = k;
                }
                if (a == 0x7fffffff)
                    a = -1;
                if (a != -1)
                {
                    int t = vn.getTokenType(a);
                    switch (t)
                    {
                        case VTDNav.TOKEN_STARTING_TAG:
                        case VTDNav.TOKEN_DOCUMENT:
                            s = vn.getXPathStringVal();
                            break;
                        case VTDNav.TOKEN_ATTR_NAME:
                            s = vn.toString(a + 1);
                            break;
                        case VTDNav.TOKEN_PI_NAME:
                            //if (a + 1 < vn.vtdSize
                            //		|| vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL)
                            s = vn.toString(a + 1);
                            break;
                        default:
                            s = vn.toString(a);
                            break;
                    }
                }
            }
            catch (Exception e)
            {

            }
            vn.contextStack2.size = size;
            reset(vn);
            vn.pop2();
            return s;
		}