本文整理汇总了C#中com.ximpleware.VTDNav.push2方法的典型用法代码示例。如果您正苦于以下问题:C# VTDNav.push2方法的具体用法?C# VTDNav.push2怎么用?C# VTDNav.push2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ximpleware.VTDNav
的用法示例。
在下文中一共展示了VTDNav.push2方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;*/
}
示例2: getStringIndex
/// <summary>
///
/// </summary>
/// <param name="vn"></param>
/// <returns></returns>
protected int getStringIndex(VTDNav vn)
{
int a = -1;
vn.push2();
int size = vn.contextStack2.size;
try
{
a = evalNodeSet(vn);
if (a != -1)
{
int t = vn.getTokenType(a);
if (t == VTDNav.TOKEN_ATTR_NAME)
{
a++;
}
else if (vn.getTokenType(a) == VTDNav.TOKEN_STARTING_TAG)
{
a = vn.getText();
}
else if (t == VTDNav.TOKEN_PI_NAME)
{
a++;
}
}
}
catch (Exception e)
{
}
vn.contextStack2.size = size;
reset(vn);
vn.pop2();
return a;
}
示例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: 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;
}
示例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: 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;
}
示例7: 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
{
//.........这里部分代码省略.........
示例8: 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;
//.........这里部分代码省略.........
示例9: 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;
}
}
示例10: 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");
*/
}
示例11: 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;
}
示例12: 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;
}
示例13: evalString
public override System.String evalString(VTDNav vn)
{
String s = "";
int a = 0x7fffffff, k = -1;
vn.push2();
int size = vn.contextStack2.size;
try
{
//a = evalNodeSet(vn);
if (needReordering)
{
while ((k = evalNodeSet(vn)) != -1)
{
// a = evalNodeSet(vn);
if (k < a)
a = k;
}
if (a == 0x7fffffff)
a = -1;
}
else
{
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;
}
}
}
catch (Exception e)
{
}
vn.contextStack2.size = size;
reset(vn);
vn.pop2();
return s;
}
示例14: 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");
}
}
示例15: process_DDFP
private int process_DDFP(VTDNav vn)
{
AutoPilot ap;
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 == START)
state = END;
else
{
currentStep = currentStep.prevS;
state = BACKWARD;
}
break;
}
String helper = null;
if (currentStep.nt.testType == NodeTest.NAMETEST)
{
helper = currentStep.nt.nodeName;
}
else if (currentStep.nt.testType == NodeTest.NODE)
{
helper = "*";
}
else
throw new XPathEvalException("can't run descendant "
+ "following, or following-sibling axis over comment(), pi(), and text()");
if (currentStep.o == null)
currentStep.o = ap = new AutoPilot(vn);
else
{
ap = (AutoPilot)currentStep.o;
ap.bind(vn);
}
if (currentStep.ft)
{
if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0)
if (currentStep.nt.testType == NodeTest.NODE || helper.Equals("*"))
ap.Special=(true);
else
ap.Special=(false);
//currentStep.o = ap = new AutoPilot(vn);
if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0)
ap.selectElement(helper);
else if (currentStep.axis_type == AxisType.DESCENDANT0)
ap.selectElement_D(helper);
else if (currentStep.axis_type == AxisType.PRECEDING0)
ap.selectElement_P(helper);
else
ap.selectElement_F(helper);
currentStep.ft = false;
}
if (state == START)
state = END;
vn.push2(); // not the most efficient. good for now
//System.out.println(" --++ push in //");
b = false;
while (ap.iterate())
{
if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
{
b = true;
break;
}
}
if (b == false)
{
vn.pop2();
//System.out.println(" --++ pop in //");
currentStep.ft = true;
if (currentStep.hasPredicate)
currentStep.resetP(vn);
if (state == FORWARD)
{
//.........这里部分代码省略.........