当前位置: 首页>>代码示例>>C#>>正文


C# VTDNav.getTokenType方法代码示例

本文整理汇总了C#中com.ximpleware.VTDNav.getTokenType方法的典型用法代码示例。如果您正苦于以下问题:C# VTDNav.getTokenType方法的具体用法?C# VTDNav.getTokenType怎么用?C# VTDNav.getTokenType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ximpleware.VTDNav的用法示例。


在下文中一共展示了VTDNav.getTokenType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getLocalName

        private String getLocalName(VTDNav vn)
        {
            if (argCount() == 0)
            {
                try
                {
                    int index = vn.getCurrentIndex();
                    int type = vn.getTokenType(index);
                    if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG
                            || type == VTDNav.TOKEN_ATTR_NAME))
                    {
                        long offset = vn.getTokenOffset(index);
                        int length = vn.getTokenLength(index);
                        if (length < 0x10000)
                            return vn.toRawString(index);
                        else
                        {
                            int preLen = length >> 16;
                            int QLen = length & 0xffff;
                            if (preLen != 0)
                                return vn.toRawString(offset + preLen + 1, QLen
                                        - preLen - 1);
                            else
                            {
                                return vn.toRawString(offset, QLen);
                            }
                        }
                    }
                    else
                        return "";
                }
                catch (NavException e)
                {
                    return ""; // this will almost never occur
                }

            } else if (argCount() == 1)
            {
                int a = -1;
                vn.push2();
                try
                {
                    a = argumentList.e.evalNodeSet(vn);
                    argumentList.e.reset(vn);
                    vn.pop2();
                }
                catch (Exception e)
                {
                    argumentList.e.reset(vn);
                    vn.pop2();
                }

                if (a == -1 || vn.ns == false)
                    return "";
                int type = vn.getTokenType(a);
                if (type != VTDNav.TOKEN_STARTING_TAG && type != VTDNav.TOKEN_ATTR_NAME)
                    return "";
                try
                {
                    long offset = vn.getTokenOffset(a);
                    int length = vn.getTokenLength(a);
                    if (length < 0x10000)
                        return vn.toRawString(a);
                    else
                    {
                        int preLen = length >> 16;
                        int QLen = length & 0xffff;
                        if (preLen != 0)
                            return vn.toRawString(offset + preLen + 1,
                                    QLen - preLen - 1);
                        else
                        {
                            return vn.toRawString(offset, QLen);
                        }
                    }
                }
                catch (NavException e)
                {
                    return ""; // this will almost never occur
                }
            }
            else
                throw new System.ArgumentException
                ("local-name()'s argument count is invalid");
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:85,代码来源:FuncExpr.cs

示例2: evalNumber

        public override double evalNumber(VTDNav vn)
        {
            int ac = 0;
            switch (opCode)
            {

                case FuncName.LAST: /*if (argCount() != 0)
                        throw new System.ArgumentException("floor()'s argument count is invalid");*/
                    return contextSize;

                case FuncName.POSITION: /*if (argCount() != 0)
                        throw new System.ArgumentException("position()'s argument count is invalid");*/
                    return position;

                case FuncName.COUNT: return count(vn);

                case FuncName.NUMBER: /*if (argCount() != 1)
                        throw new System.ArgumentException("number()'s argument count is invalid");*/
                    return argumentList.e.evalNumber(vn);


                case FuncName.SUM: return sum(vn);

                case FuncName.FLOOR: /*if (argCount() != 1)
                        throw new System.ArgumentException("floor()'s argument count is invalid");*/
                    return System.Math.Floor(argumentList.e.evalNumber(vn));


                case FuncName.CEILING: /*if (argCount() != 1)
                        throw new System.ArgumentException("ceiling()'s argument count is invalid");*/
                    return System.Math.Ceiling(argumentList.e.evalNumber(vn));


                case FuncName.STRING_LENGTH:
                    //return stringLen
                    ac = argCount();
                    if (ac == 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 i = vn.getText();
                                if (i == -1)
                                    return 0;
                                else
                                    return vn.getStringLength(i);
                            }
                        }
                        catch (NavException e)
                        {
                            return 0;
                        }
                    }
                    else if (ac == 1)
                    {
                        return argumentList.e.evalString(vn).Length;
                    }
                    else
                    {
                        throw new System.ArgumentException("string-length()'s argument count is invalid");
                    }
                //goto case FuncName.ROUND;


                case FuncName.ROUND:/* if (argCount() != 1)
                        throw new System.ArgumentException("round()'s argument count is invalid");*/
                    //UPGRADE_TODO: Method 'java.lang.Math.round' was converted to 'System.Math.Round' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangMathround_double'"
                    return (long)System.Math.Round(argumentList.e.evalNumber(vn));

                case FuncName.ABS: /*if (argCount() != 1)
                        throw new System.ArgumentException("abs()'s argument count is invalid");*/
                    //UPGRADE_TODO: Method 'java.lang.Math.round' was converted to 'System.Math.Round' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangMathround_double'"
                    return (long)System.Math.Abs(argumentList.e.evalNumber(vn));
                case FuncName.ROUND_HALF_TO_EVEN:
                    return roundHalfToEven(vn);
                    /*int numArg = argCount();
                    if (numArg < 1 || numArg > 2)
                    {
                        throw new System.ArgumentException("Argument count for roundHalfToEven() is invalid. Expected: 1 or 2; Actual: " + numArg);
                    }

                    double value = argumentList.e.evalNumber(vn);
                    int precision = (numArg == 2) ? (int)Math.Floor(argumentList.next.e.evalNumber(vn) + 0.5d) : 0;
                    return (long)System.Math.Round(value, precision, MidpointRounding.ToEven);*/

                case FuncName.ROUND_HALF_TO_ODD:
                    throw new com.ximpleware.xpath.UnsupportedException("not yet implemented");
//.........这里部分代码省略.........
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:101,代码来源:FuncExpr.cs

示例3: evalString

        public override System.String evalString(VTDNav vn)
        {
            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.getXPathStringVal2(a,(short)0);
                            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;
        }
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:41,代码来源:LocationPathExpr.cs

示例4: getString

 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");
 }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:24,代码来源:FuncExpr.cs

示例5: getNameSpaceURI

        private String getNameSpaceURI(VTDNav vn)
        {
            if (argCount1 == 0)
            {
                try
                {
                    int i = vn.getCurrentIndex();
                    int type = vn.getTokenType(i);

                    if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG
                            || type == VTDNav.TOKEN_ATTR_NAME))
                    {
                        int a = vn.lookupNS();
                        if (a == 0)
                            return "";
                        else
                            return vn.toString(a);
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
            else if (argCount1 == 1 && argumentList.e.NodeSet)
            {
                vn.push2();
                int size = vn.contextStack2.size;
                int a = -1;
                try
                {
                    a = argumentList.e.evalNodeSet(vn);
                }
                catch (Exception e)
                {
                }
                String s = "";
                // return a;
                try
                {
                    if (a == -1 || vn.ns == false)
                    { }
                    else
                    {
                        int type = vn.getTokenType(a);
                        if (type == VTDNav.TOKEN_STARTING_TAG
                                || type == VTDNav.TOKEN_ATTR_NAME)
                            s = vn.toString(vn.lookupNS());

                    }
                }
                catch (Exception e) { };
                vn.contextStack2.size = size;
                argumentList.e.reset(vn);
                vn.pop2();
                return s;

            }
            else
                throw new System.ArgumentException
                ("namespace-uri()'s argument count is invalid");
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:63,代码来源:FuncExpr.cs

示例6: lowerCase

 private String lowerCase(VTDNav vn)
 {
     if (argCount1 == 1)
     {
         if (argumentList.e.NodeSet)
         {
             int a = evalFirstArgumentListNodeSet(vn);
             if (a == -1)
                 return "";
             else
             {
                 try
                 {
                     int t = vn.getTokenType(a);
                     if (t != VTDNav.TOKEN_STARTING_TAG && t != VTDNav.TOKEN_DOCUMENT)
                         return vn.toStringLowerCase(a);
                     return vn.getXPathStringVal2(a, (short)2);
                 }
                 catch (Exception e)
                 {
                 }
                 return "";
             }
         }
         else
         {
             return (argumentList.e.evalString(vn)).ToLower();
         }
     }
     else
         throw new System.ArgumentException
         ("lowerCase()'s argument count is invalid");
 }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:33,代码来源:FuncExpr.cs

示例7: matchLocalName

        private bool matchLocalName(VTDNav vn)
        {
            if (argCount1 == 1)
            {
                try
                {
                    int index = vn.getCurrentIndex();
                    int type = vn.getTokenType(index);
                    String s1 = argumentList.e.evalString(vn);
                    if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG
                            || type == VTDNav.TOKEN_ATTR_NAME))
                    {
                        int offset = vn.getTokenOffset(index);
                        int length = vn.getTokenLength(index);
                        if (length < 0x10000 || (length >> 16) == 0)
                        {
                            return (vn.compareRawTokenString(index, s1) == 0);//vn.toRawString(index);
                        }
                        else
                        {
                            int preLen = length >> 16;
                            int QLen = length & 0xffff;
                            if (preLen != 0)
                            {
                                return (vn.compareRawTokenString(offset + preLen + 1, QLen
                                           - preLen - 1, s1) == 0);
                            }
                        }
                    }
                    else if (type == VTDNav.TOKEN_PI_NAME)
                    {
                        return vn.compareRawTokenString(index, s1) == 0;
                    }
                    else
                        return "".Equals(s1);
                }
                catch (NavException e)
                {
                    return false; // this will never occur
                }

            }
            else if (argCount1 == 2)
            {
                int a = evalFirstArgumentListNodeSet2(vn);
                String s1 = argumentList.next.e.evalString(vn);
                if (a == -1 || vn.ns == false)
                    return "".Equals(s1);
                int type = vn.getTokenType(a);
                if (type == VTDNav.TOKEN_STARTING_TAG || type == VTDNav.TOKEN_ATTR_NAME)
                {
                    //return "".equals(s1);
                    try
                    {
                        int offset = vn.getTokenOffset(a);
                        int length = vn.getTokenLength(a);
                        if (length < 0x10000 || (length >> 16) == 0)
                            return vn.compareRawTokenString(a, s1) == 0;
                        else
                        {
                            int preLen = length >> 16;
                            int QLen = length & 0xffff;
                            if (preLen != 0)
                                return vn.compareRawTokenString(offset + preLen + 1,
                                        QLen - preLen - 1, s1) == 0;
                            /*else {
                                return vn.toRawString(offset, QLen);
                            }*/
                        }
                    }
                    catch (NavException e)
                    {
                        return "".Equals(s1); // this will almost never occur
                    }
                }
                else if (type == VTDNav.TOKEN_PI_NAME)
                {
                    try
                    {
                        return vn.compareRawTokenString(a, s1) == 0;
                    }
                    catch (NavException e)
                    {
                        return "".Equals(s1);
                    }
                }
                return "".Equals(s1);
            }
            else
                throw new ArgumentException
                ("match-local-name()'s argument count is invalid");
            return false;
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:93,代码来源:FuncExpr.cs

示例8: compareTokens

        /// <summary>
        /// <em>New in 2.0</em>
        /// This method compares two VTD tokens of VTDNav objects
        /// The behavior of this method is like compare the strings corresponds
        /// to i1 and i2
        /// </summary>
        /// <param name="i"></param>
        /// <param name="vn2"></param>
        /// <param name="i2"></param>
        /// <returns></returns>
        public int compareTokens(int i1, VTDNav vn2, int i2)
        {
            int t1, t2;
            int ch1, ch2;
            int endOffset1, endOffset2;
            long l;

            if (i1 == i2 && this == vn2)
                return 0;

            t1 = this.getTokenType(i1);
            t2 = vn2.getTokenType(i2);

            int offset1 = this.getTokenOffset(i1);
            int offset2 = vn2.getTokenOffset(i2);
            int len1 =
            (t1 == TOKEN_STARTING_TAG
                || t1 == TOKEN_ATTR_NAME
                || t1 == TOKEN_ATTR_NS)
                ? getTokenLength(i1) & 0xffff
                : getTokenLength(i1);
            int len2 =
                (t2 == TOKEN_STARTING_TAG
                    || t2 == TOKEN_ATTR_NAME
                    || t2 == TOKEN_ATTR_NS)
                    ? vn2.getTokenLength(i2) & 0xffff
                    : vn2.getTokenLength(i2);
            endOffset1 = len1 + offset1;
            endOffset2 = len2 + offset2;

            for (; offset1 < endOffset1 && offset2 < endOffset2; )
            {
                if (t1 == VTDNav.TOKEN_CHARACTER_DATA
                        || t1 == VTDNav.TOKEN_ATTR_VAL)
                {
                    l = this.getCharResolved(offset1);
                }
                else
                {
                    l = this.getChar(offset1);
                }
                ch1 = (int)l;
                offset1 += (int)(l >> 32);

                if (t2 == VTDNav.TOKEN_CHARACTER_DATA
                        || t2 == VTDNav.TOKEN_ATTR_VAL)
                {
                    l = vn2.getCharResolved(offset2);
                }
                else
                {
                    l = vn2.getChar(offset2);
                }
                ch2 = (int)l;
                offset2 += (int)(l >> 32);

                if (ch1 > ch2)
                    return 1;
                if (ch1 < ch2)
                    return -1;
            }

            if (offset1 == endOffset1
                    && offset2 < endOffset2)
                return -1;
            else if (offset1 < endOffset1
                    && offset2 == endOffset2)
                return 1;
            else
                return 0;
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:81,代码来源:VTDNav.cs

示例9: getNextChar

    protected internal int getNextChar(VTDNav vn,helper h){
		long l;
		int result;		
		if (h.type==0){// single token
			if (h.offset == h.endOffset)
				return -1;
			if (h.tokenType == VTDNav.TOKEN_CHARACTER_DATA &&
					h.tokenType !=VTDNav.TOKEN_ATTR_VAL){ 
				l = vn.getCharResolved(h.offset);
			}else {
				l = vn.getChar(h.offset);
			}
			h.offset += (int)(l>>32);
			result = (int)l;
			return result;
			
		}else {// text value
			if (h.offset < h.endOffset){
				//return result;
				if (h.tokenType != VTDNav.TOKEN_PI_VAL &&
					h.tokenType !=VTDNav.TOKEN_CHARACTER_DATA){ 
					l = vn.getChar(h.offset);
				}else {
					l = vn.getChar(h.offset);
				}
				h.offset += (int)(l>>32);
				result = (int)l;	
				return result;
			}else{
				h.index++;
				while (h.index < vtdSize) {
				    int tokenType = vn.getTokenType(h.index);
				    int depth = vn.getTokenDepth(h.index);
				    //t=t+getTokenLength2(index);
				    if (depth<h.depth || 
				    		(depth==h.depth && tokenType==VTDNav.TOKEN_STARTING_TAG)){
				    	break;
				    }
				    
				    if (tokenType==VTDNav.TOKEN_CHARACTER_DATA
				    		|| tokenType==VTDNav.TOKEN_CDATA_VAL){
				    	//length = getTokenLength2(index);
				    	//t += length;
				    	//fib.append(index);
				    	h.offset = vn.getTokenOffset(h.index);
				    	h.endOffset = vn.getTokenOffset(h.index)+vn.getTokenLength2(h.index);
				    	h.tokenType = tokenType;
				    	//h2.index++;
				    	return getNextChar(vn,h);
				    	//
				    } else if (tokenType==VTDNav.TOKEN_ATTR_NAME
					        || tokenType == VTDNav.TOKEN_ATTR_NS
					        || tokenType == VTDNav.TOKEN_PI_NAME){			  
					    h.index = h.index+2;
					    continue;
					}			
					h.index++;
				}
				return -1;
			}
		}
		//return -1;
	}
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:63,代码来源:VTDNav.cs

示例10: getStringIndex

        /// <summary>
        /// 
        /// </summary>
        /// <param name="vn"></param>
        /// <returns></returns>
        protected int getStringIndex(VTDNav vn)
        {
            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)
                    {
                        a++;
                    }
                    else if (vn.getTokenType(a) == VTDNav.TOKEN_STARTING_TAG)
                    {
                        a = vn.getText();
                    }
                    else if (t == VTDNav.TOKEN_PI_NAME)
                    {
                        a++;
                    }
                }
            }
            catch (Exception e)
            {

            }
            vn.contextStack2.size = size;
            reset(vn);
            vn.pop2();
            return a;
        }
开发者ID:DuLerWeil,项目名称:vtd-xml,代码行数:39,代码来源:Expr.cs

示例11: getStringLen

        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");
            }
        }
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:94,代码来源:FuncExpr.cs

示例12: normalizeSpace

 private System.String normalizeSpace(VTDNav vn)
 {
     if (argCount() == 0)
     {
         String s = null;
         try
         {
             if (vn.atTerminal)
             {
                 int ttype = vn.getTokenType(vn.LN);
                 if (ttype == VTDNav.TOKEN_CDATA_VAL)
                     s = vn.toRawString(vn.LN);
                 else if (ttype == VTDNav.TOKEN_ATTR_NAME ||
                      ttype == VTDNav.TOKEN_ATTR_NS)
                 {
                     s = vn.toString(vn.LN + 1);
                 }
                 else
                     s = vn.toString(vn.LN);
             }else
                 s = vn.toString(vn.getCurrentIndex());
             return normalize(s);
         }
         catch (NavException e)
         {
             return ""; // this will almost never occur
         }
     }
     else if (argCount() == 1)
     {
         String s = argumentList.e.evalString(vn);
         return normalize(s);
     }
     throw new System.ArgumentException("normalize-space()'s argument count is invalid");
     //return null;
 }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:36,代码来源:FuncExpr.cs

示例13: evalNumber

		public override double evalNumber(VTDNav vn)
		{
			int ac = 0;
			switch (opCode)
			{
				
				case FuncName.LAST:  if (argCount() != 0)
						throw new System.ArgumentException("floor()'s argument count is invalid");
					return contextSize;
				
				case FuncName.POSITION:  if (argCount() != 0)
						throw new System.ArgumentException("position()'s argument count is invalid");
					return position;
				
				case FuncName.COUNT:  return count(vn);
				
				case FuncName.NUMBER:  if (argCount() != 1)
						throw new System.ArgumentException("number()'s argument count is invalid");
					return argumentList.e.evalNumber(vn);
				
				
				case FuncName.SUM:  return sum(vn);
				
				case FuncName.FLOOR:  if (argCount() != 1)
						throw new System.ArgumentException("floor()'s argument count is invalid");
					return System.Math.Floor(argumentList.e.evalNumber(vn));
				
				
				case FuncName.CEILING:  if (argCount() != 1)
						throw new System.ArgumentException("ceiling()'s argument count is invalid");
					return System.Math.Ceiling(argumentList.e.evalNumber(vn));
				
				
				case FuncName.STRING_LENGTH: 
					ac = argCount();
					if (ac == 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 i = vn.getText();
								if (i == - 1)
									return 0;
								else
									return vn.getStringLength(i);
							}
						}
						catch (NavException e)
						{
							return 0;
						}
					}
					else if (ac == 1)
					{
						return argumentList.e.evalString(vn).Length;
					}
					else
					{
						throw new System.ArgumentException("string-length()'s argument count is invalid");
					}
					//goto case FuncName.ROUND;
				
				
				case FuncName.ROUND:  if (argCount() != 1)
						throw new System.ArgumentException("round()'s argument count is invalid");
					//UPGRADE_TODO: Method 'java.lang.Math.round' was converted to 'System.Math.Round' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangMathround_double'"
					return (long) System.Math.Round(argumentList.e.evalNumber(vn));
				
				
				default:  if (isBoolean_Renamed_Field)
					{
						if (evalBoolean(vn))
							return 1;
						else
							return 0;
					}
					else
					{
						return System.Double.Parse(evalString(vn));
					}
					//break;
				
			}
		}
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:97,代码来源:FuncExpr.cs

示例14: getName

        private String getName(VTDNav vn)
        {
            int a;
            if (argCount() == 0)
            {
                a = vn.getCurrentIndex();
                int type = vn.getTokenType(a);

                if ((type == VTDNav.TOKEN_STARTING_TAG
                        || type == VTDNav.TOKEN_ATTR_NAME))
                {
                    try
                    {
                        return vn.toString(a);
                    }
                    catch (Exception e)
                    {
                        return "";
                    }
                }
                else
                    return "";
            }
            else if (argCount() == 1)
            {
                a = -1;
                vn.push2();
                try
                {
                    a = argumentList.e.evalNodeSet(vn);
                    argumentList.e.reset(vn);
                    vn.pop2();
                }
                catch (Exception e)
                {
                    argumentList.e.reset(vn);
                    vn.pop2();
                }
                try
                {
                    if (a == -1 || vn.ns == false)
                        return "";
                    else
                    {
                        int type = vn.getTokenType(a);
                        if (type == VTDNav.TOKEN_STARTING_TAG
                                || type == VTDNav.TOKEN_ATTR_NAME)
                            return vn.toString(a);
                        return "";
                    }
                }
                catch (Exception e)
                {
                }
                return "";
            }
            else
                throw new System.ArgumentException
                ("name()'s argument count is invalid");

        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:61,代码来源:FuncExpr.cs

示例15: contains

 private bool contains(VTDNav vn)
 {
     String s2 = argumentList.next.e.evalString(vn);
     if (argumentList.e.NodeSet)
     {
         int a = evalFirstArgumentListNodeSet(vn);
         if (a == -1)
             return false;
         try
         {
             int t = vn.getTokenType(a);
             if (t != VTDNav.TOKEN_STARTING_TAG && t != VTDNav.TOKEN_DOCUMENT)
                 return vn.contains(a, s2);
             else
                 return vn.XPathStringVal_Contains(a, s2);
         }
         catch (Exception e)
         {
             return false;
         }
     }
     String s1 = argumentList.e.evalString(vn);
     //return s1.contains(s2);
     return s1.IndexOf(s2) != -1;
     //return (s1.i))
 }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:26,代码来源:FuncExpr.cs


注:本文中的com.ximpleware.VTDNav.getTokenType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。