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


C# VTDNav.getCharResolved方法代码示例

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


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

示例1: 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

示例2: 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


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