本文整理汇总了C#中com.ximpleware.VTDNav.pop2方法的典型用法代码示例。如果您正苦于以下问题:C# VTDNav.pop2方法的具体用法?C# VTDNav.pop2怎么用?C# VTDNav.pop2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ximpleware.VTDNav
的用法示例。
在下文中一共展示了VTDNav.pop2方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: evalNumber
/// <summary>
///
/// </summary>
/// <param name="vn"></param>
/// <returns></returns>
public override double evalNumber(VTDNav vn)
{
double d = Double.NaN;
int a = 0x7fffffff, k = -1;
vn.push2();
int size = vn.contextStack2.size;
try
{
while ((k = evalNodeSet(vn)) != -1)
{
//a = evalNodeSet(vn);
if (k < a)
a = k;
}
if (a == 0x7fffffff)
a = -1;
if (a != -1)
{
int t = vn.getTokenType(a);
if (t == VTDNav.TOKEN_ATTR_NAME)
{
d = vn.parseDouble(a + 1);
}
else if (t == VTDNav.TOKEN_STARTING_TAG || t == VTDNav.TOKEN_DOCUMENT)
{
d = vn.XPathStringVal2Double(a);//Double.parseDouble(s);
}
else if (t == VTDNav.TOKEN_PI_NAME)
{
if (a + 1 < vn.vtdSize || vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL)
//s = vn.toString(a+1);
d = vn.parseDouble(a + 1);
else
d = Double.NaN;
}
else
d = vn.parseDouble(a);
}
}
catch (Exception e)
{
}
vn.contextStack2.size = size;
reset(vn);
vn.pop2();
//return s;
return d;
}
示例2: computeContextSize4FollowingSibling
protected internal int computeContextSize4FollowingSibling(Predicate p, VTDNav vn)
{
int i=0;
//AutoPilot ap = (AutoPilot)currentStep.o;
vn.push2();
while(vn.toElement(VTDNav.NEXT_SIBLING)){
if (currentStep.eval(vn,p)){
i++;
}
}
vn.pop2();
currentStep.resetP(vn,p);
currentStep.out_of_range=false;
//currentStep.o = ap;
return i;
}
示例3: computeContextSize4PrecedingSibling2
protected internal int computeContextSize4PrecedingSibling2(Predicate p, VTDNav vn)
{
int i=0;
vn.push2();
while(vn.toNode(VTDNav.PREV_SIBLING)){
if (currentStep.eval2(vn,p)){
i++;
}
}
vn.pop2();
currentStep.resetP(vn,p);
currentStep.out_of_range=false;
//currentStep.o = ap;
return i;
}
示例4: 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;
}
示例5: computeContextSize4DDFP
protected internal int computeContextSize4DDFP(Predicate p, VTDNav vn)
{
String helper = null;
int i=0;
AutoPilot ap = (AutoPilot)currentStep.o;
if (currentStep.nt.testType == NodeTest.NODE){
helper = "*";
}else if (currentStep.nt.testType == NodeTest.NAMETEST){
helper = currentStep.nt.nodeName;
}else
throw new XPathEvalException("can't run descendant "
+ "following, or following-sibling axis over comment(), pi(), and text()");
if (ap==null)
ap = new AutoPilot(vn);
else
ap.bind(vn);
if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0 )
if (currentStep.nt.testType == NodeTest.NODE || helper.Equals("*"))
ap.Special=true;
else
ap.Special=true;
//currentStep.o = ap = new AutoPilot(vn);
if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0)
if (currentStep.nt.localName!=null)
ap.selectElementNS(currentStep.nt.URL,currentStep.nt.localName);
else
ap.selectElement(helper);
else if (currentStep.axis_type == AxisType.DESCENDANT0)
if (currentStep.nt.localName!=null)
ap.selectElementNS_D(currentStep.nt.URL,currentStep.nt.localName);
else
ap.selectElement_D(helper);
else if (currentStep.axis_type == AxisType.PRECEDING0)
if (currentStep.nt.localName!=null)
ap.selectElementNS_P(currentStep.nt.URL,currentStep.nt.localName);
else
ap.selectElement_P(helper);
else
if (currentStep.nt.localName!=null)
ap.selectElementNS_F(currentStep.nt.URL,currentStep.nt.localName);
else
ap.selectElement_F(helper);
vn.push2();
while(ap.iterate()){
if (currentStep.evalPredicates(vn,p)){
i++;
}
}
vn.pop2();
currentStep.resetP(vn,p);
currentStep.out_of_range=false;
currentStep.o = ap;
return i;
}
示例6: process_preceding_sibling
private int process_preceding_sibling(VTDNav vn)
{
bool b = false, b1 = false;
Predicate t = null;
int result;
switch (state)
{
case START:
case FORWARD:
t = currentStep.p;
while (t != null)
{
if (t.requireContext)
{
int i = computeContextSize(t, vn);
if (i == 0)
{
b1 = true;
break;
}
else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1)
{
if (state == FORWARD)
{
state = BACKWARD;
currentStep = currentStep.prevS;
}
else
state = END;
break;
}
if (state == START)
state = END;
else
state = BACKWARD;
vn.push2();
while (vn.toElement(VTDNav.PS))
{
if ((currentStep.nt_eval || currentStep.nt.eval(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
{
if (currentStep.nextS != null)
{
state = FORWARD;
currentStep = currentStep.nextS;
break;
}
else
{
state = TERMINAL;
result = vn.getCurrentIndex2();
if (isUnique(result))
return result;
}
}
}
if(state == END) {
if (currentStep.hasPredicate)
currentStep.resetP(vn);
vn.pop2();
}else if (state == BACKWARD)
{
if (currentStep.hasPredicate)
currentStep.resetP(vn);
vn.pop2();
currentStep = currentStep.prevS;
}
break;
case END:
currentStep = null;
// reset();
return -1;
case BACKWARD:
if (currentStep.out_of_range)
{
currentStep.out_of_range = false;
transition_preceding_sibling(vn);
break;
}
while (vn.toElement(VTDNav.PS))
{
if ((currentStep.nt_eval || currentStep.nt.eval(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
{
if (currentStep.nextS != null)
{
state = FORWARD;
currentStep = currentStep.nextS;
b = true;
break;
}
else
{
//.........这里部分代码省略.........
示例7: transition_preceding_sibling
private void transition_preceding_sibling(VTDNav vn)
{
vn.pop2();
if (currentStep.hasPredicate)
currentStep.resetP(vn);
if(currentStep.prevS!=null){
currentStep = currentStep.prevS;
state = BACKWARD;
}else{
state = END;
}
}
示例8: sum
private double sum(VTDNav vn)
{
double d = 0;
/*if (argCount() != 1 || argumentList.e.NodeSet == false)
throw new System.ArgumentException("sum()'s argument count is invalid");*/
vn.push2();
try
{
a = 0;
int i1;
while ((a = argumentList.e.evalNodeSet(vn)) != -1)
{
int t = vn.getTokenType(a);
if (t == VTDNav.TOKEN_STARTING_TAG)
{
i1 = vn.getText();
if (i1 != -1)
d = d + vn.parseDouble(i1);
if (System.Double.IsNaN(d))
break;
}
else if (t == VTDNav.TOKEN_ATTR_NAME || t == VTDNav.TOKEN_ATTR_NS)
{
d = d + vn.parseDouble(a + 1);
if (System.Double.IsNaN(d))
break;
}
else if (t == VTDNav.TOKEN_CHARACTER_DATA
|| t == VTDNav.TOKEN_CDATA_VAL
|| t == VTDNav.TOKEN_COMMENT)
{
d = d + vn.parseDouble(a);
if (System.Double.IsNaN(d))
break;
}
else if (t == VTDNav.TOKEN_PI_NAME)
{
if (a + 1 < vn.vtdSize && vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL)
{
d += vn.parseDouble(a + 1);
}
else
{
d = Double.NaN;
break;
}
}
// fib1.append(i);
}
argumentList.e.reset(vn);
vn.pop2();
return d;
}
catch (System.Exception e)
{
argumentList.e.reset(vn);
vn.pop2();
return System.Double.NaN;
}
}
示例9: lang
/// <summary>
///
/// </summary>
/// <param name="vn"></param>
/// <param name="s"></param>
/// <returns></returns>
private bool lang(VTDNav vn, String s)
{
// check the length of s
bool b = false;
vn.push2();
try
{
while (vn.getCurrentDepth() >= 0)
{
int i = vn.getAttrVal("xml:lang");
if (i != -1)
{
b = vn.matchTokenString(i, s);
break;
}
vn.toElement(VTDNav.P);
}
}
catch (NavException e)
{
}
vn.pop2();
return b;
}
示例10: evalString
/*
* (non-Javadoc)
*
* @see com.ximpleware.xpath.Expr#evalString(com.ximpleware.VTDNav)
*/
public override System.String evalString(VTDNav vn)
{
if (e.NodeSet == false)
return e.evalString(vn);
else
{
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.getXPathStringVal();
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;
}
/*if (t == VTDNav.TOKEN_ATTR_NAME) {
s = vn.toString(a + 1);
} else if (t == VTDNav.TOKEN_STARTING_TAG
|| t == VTDNav.TOKEN_DOCUMENT) {
s = vn.getXPathStringVal();
} else if (t == VTDNav.TOKEN_PI_NAME) {
if (a + 1 < vn.vtdSize
|| vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL)
s = vn.toString(a + 1);
// s = vn.toString(a+1);
} else
s = vn.toString(a);*/
}
}
catch (Exception ee)
{
}
vn.contextStack2.size = size;
reset(vn);
vn.pop2();
return s;
}
}
示例11: 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;
}
示例12: evalNodeSet
/// <summary>
///
/// </summary>
/// <param name="vn"></param>
/// <returns></returns>
public override int evalNodeSet(VTDNav vn)
{
int a;
/*if (this.next == null)
{
return e.evalNodeSet(vn);
}
else
{*/
while (true)
{
switch (state)
{
case 0:
if (ih == null)
ih = new intHash();
if (current != null)
{
vn.push2();
while ((a = current.e.evalNodeSet(vn)) != -1)
{
if (isUnique(a))
{
state = 1;
return a;
}
}
state = 2;
vn.pop2();
break;
}
else
state = 3;
break;
case 1:
while ((a = current.e.evalNodeSet(vn)) != -1)
{
if (isUnique(a))
{
state = 1;
return a;
}
}
state = 2;
vn.pop2();
break;
case 2:
current = current.next;
if (current != null)
{
vn.push2();
while ((a = current.e.evalNodeSet(vn)) != -1)
{
if (isUnique(a))
{
state = 1;
return a;
}
}
vn.pop2();
break;
}
else
state = 3;
break;
case 3:
return -1;
default:
throw new XPathEvalException("Invalid state evaluating PathExpr");
}
}
// }
/*
* default: throw new XPathEvalException( "Invalid state evaluating
* PathExpr");
*/
}
示例13: evalBoolean
/// <summary>
///
/// </summary>
/// <param name="vn"></param>
/// <returns></returns>
public override bool evalBoolean(VTDNav vn)
{
bool a = false;
vn.push2();
// record teh stack size
int size = vn.contextStack2.size;
try
{
a = (evalNodeSet(vn) != -1);
}
catch (System.Exception ee)
{
}
//rewind stack
vn.contextStack2.size = size;
reset(vn);
vn.pop2();
return a;
//}
/*if (e.Numerical)
{
double dval = e.evalNumber(vn);
if (dval == 0.0 || System.Double.IsNaN(dval))
return false;
return true;
}
String s = e.evalString(vn);
if (s == null || s.Length == 0)
return false;
return true;*/
}
示例14: evalNodeSet
public override int evalNodeSet(VTDNav vn)
{
int a;
while (true)
{
switch (evalState)
{
case 0: //this state is teh initial state;
a = fe.evalNodeSet(vn);
if (a == - 1)
{
evalState = 4;
}
else
evalState = 1;
break;
case 1: // fe returns valid value, then iterate the locationPath
vn.push2();
a = lpe.evalNodeSet(vn);
if (a == - 1)
{
lpe.reset(vn);
evalState = 3;
}
else
{
evalState = 2;
if (isUnique(a))
return a;
}
break;
case 2:
a = lpe.evalNodeSet(vn);
if (a == - 1)
{
lpe.reset(vn);
evalState = 3;
}
else
{
if (isUnique(a))
return a;
//return a;
}
break;
case 3:
vn.pop2();
a = fe.evalNodeSet(vn);
if (a == - 1)
evalState = 4;
else
{
vn.push2();
evalState = 2;
}
break;
case 4:
return - 1;
default:
throw new XPathEvalException("Invalid state evaluating PathExpr");
}
}
//return -1;
}
示例15: process_namespace
private int process_namespace(VTDNav vn)
{
AutoPilot ap = null;
bool b1 = false;
Predicate t = null;
int temp;
switch (state)
{
case START:
case FORWARD:
t = currentStep.p;
while (t != null)
{
if (t.requireContext)
{
int i = computeContextSize(t, vn);
if (i == 0)
{
b1 = true;
break;
}
else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1)
{
if (state == FORWARD)
{
state = BACKWARD;
currentStep = currentStep.prevS;
}
else
state = END;
break;
}
if (vn.atTerminal)
{
if (state == START)
state = END;
else
{
state = BACKWARD;
currentStep = currentStep.prevS;
}
}
else
{
if (currentStep.ft)
{
if (currentStep.o == null)
currentStep.o = ap = new AutoPilot(vn);
else
{
ap = (AutoPilot)currentStep.o;
ap.bind(vn);
//ap.set_ft(true);
}
if (currentStep.nt.testType == NodeTest.NODE)
ap.selectNameSpace("*");
else
ap.selectNameSpace(currentStep.nt.nodeName);
currentStep.ft = false;
}
if (state == START)
state = END;
vn.push2();
//vn.setAtTerminal(true);
while ((temp = ap.iterateNameSpace()) != -1)
{
if ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))
{
break;
}
}
if (temp == -1)
{
vn.pop2();
currentStep.ft = true;
if (currentStep.hasPredicate)
currentStep.resetP(vn);
vn.atTerminal=(false);
if (state == FORWARD)
{
state = BACKWARD;
currentStep = currentStep.prevS;
}
}
else
{
vn.atTerminal=(true);
if (currentStep.nextS != null)
{
vn.LN = temp;
state = FORWARD;
currentStep = currentStep.nextS;
//.........这里部分代码省略.........