本文整理汇总了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;
}
示例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;
}