本文整理汇总了C#中com.ximpleware.VTDNav.getTokenLength2方法的典型用法代码示例。如果您正苦于以下问题:C# VTDNav.getTokenLength2方法的具体用法?C# VTDNav.getTokenLength2怎么用?C# VTDNav.getTokenLength2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ximpleware.VTDNav
的用法示例。
在下文中一共展示了VTDNav.getTokenLength2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XPathStringVal_Matches
/// <summary>
///
/// </summary>
/// <param name="j"></param>
/// <param name="vn2"></param>
/// <param name="k"></param>
/// <returns></returns>
protected internal int XPathStringVal_Matches(int j, VTDNav vn2, int k /*k is a token index */) {
if (h1==null){
h1 = new helper();
}
if (h2==null){
h2 = new helper();
}
int tokenType1 = getTokenType(j);
int tokenType2 = vn2.getTokenType(k);
if (tokenType1 == VTDNav.TOKEN_STARTING_TAG || tokenType1 == VTDNav.TOKEN_DOCUMENT ){
h1.index = j + 1;
h1.type = 1;
h1.depth = getTokenDepth(j);
h1.offset = -1;
while (h1.index < vtdSize) {
int tokenType = getTokenType(h1.index);
int depth = getTokenDepth(h1.index);
//t=t+getTokenLength2(index);
if (depth<h1.depth ||
(depth==h1.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);
h1.offset = getTokenOffset(h1.index);
h1.endOffset = getTokenOffset(h1.index)+getTokenLength2(h1.index);
//h1.index++;
h1.tokenType=tokenType;
goto loop11;
//
} else if (tokenType==VTDNav.TOKEN_ATTR_NAME
|| tokenType == VTDNav.TOKEN_ATTR_NS
|| tokenType == VTDNav.TOKEN_PI_NAME){
h1.index = h1.index+2;
continue;
}
h1.index++;
}
loop11:
;
}
else{
h1.index = -1;
h1.type = 0;
h1.offset = getTokenOffset(j);
h1.endOffset = getTokenOffset(j)+getTokenLength(j);
h1.tokenType = getTokenType(j);
}
if (tokenType2 == VTDNav.TOKEN_STARTING_TAG || tokenType2 == VTDNav.TOKEN_DOCUMENT ){
h2.index = k + 1;
h2.type = 1;
h2.depth = vn2.getTokenDepth(k);
h2.offset = -1;
while (h2.index < vtdSize) {
int tokenType = vn2.getTokenType(h2.index);
int depth = vn2.getTokenDepth(h2.index);
//t=t+getTokenLength2(index);
if (depth<h2.depth ||
(depth==h2.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);
h2.offset = vn2.getTokenOffset(h2.index);
h2.endOffset = vn2.getTokenOffset(h2.index)+vn2.getTokenLength2(h2.index);
h2.tokenType = tokenType;
//h2.index++;
goto loop22;
//
} else if (tokenType==VTDNav.TOKEN_ATTR_NAME
|| tokenType == VTDNav.TOKEN_ATTR_NS
|| tokenType == VTDNav.TOKEN_PI_NAME){
h2.index = h2.index+2;
continue;
}
h2.index++;
}
loop22:
;
}
else{
//.........这里部分代码省略.........
示例2: 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;
}