本文整理汇总了C#中com.ximpleware.VTDNav.getTokenCount方法的典型用法代码示例。如果您正苦于以下问题:C# VTDNav.getTokenCount方法的具体用法?C# VTDNav.getTokenCount怎么用?C# VTDNav.getTokenCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ximpleware.VTDNav
的用法示例。
在下文中一共展示了VTDNav.getTokenCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: count
private int count(VTDNav vn)
{
int a = -1;
//if (argCount1 != 1 || argumentList.e.NodeSet == false)
// throw new System.ArgumentException("Count()'s argument count is invalid");
vn.push2();
int size = vn.contextStack2.size;
try
{
a = 0;
argumentList.e.adjust(vn.getTokenCount());
while (argumentList.e.evalNodeSet(vn) != -1)
{
a++;
}
}
catch (System.Exception e)
{
}
argumentList.e.reset(vn);
vn.contextStack2.size = size;
vn.pop2();
return a;
}
示例2: 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");
}
}
示例3: evalNodeSet
public override int evalNodeSet(VTDNav vn)
{
// if tne predicate require context size
// needs to precompute the context size
// vn.push2();
// computerContext();
// set contxt();
// vn.pop2()
// if the context size is zero
// get immediately set teh state to end
// or backward
if (first_time && p.requireContext)
{
first_time = false;
int i = 0;
//vn.push2();
e.adjust(vn.getTokenCount());
while (e.evalNodeSet(vn) != -1)
i++;
//vn.pop2();
p.ContextSize = i;
reset2(vn);
}
if (out_of_range)
return -1;
int a = e.evalNodeSet(vn);
while (a != -1)
{
if (p.eval(vn) == true)
{
//p.reset();
return a;
}
else
{
//p.reset();
a = e.evalNodeSet(vn);
}
}
return -1;
}
示例4: count
private int count(VTDNav vn)
{
int a = - 1;
if (argCount() != 1 || argumentList.e.NodeSet == false)
throw new System.ArgumentException("Count()'s argument count is invalid");
vn.push2();
try
{
a = 0;
argumentList.e.adjust(vn.getTokenCount());
while (argumentList.e.evalNodeSet(vn) != - 1)
{
a++;
}
argumentList.e.reset(vn);
vn.pop2();
}
catch (System.Exception e)
{
argumentList.e.reset(vn);
vn.pop2();
}
return a;
}