本文整理汇总了C#中com.ximpleware.VTDNav.getCurrentIndex方法的典型用法代码示例。如果您正苦于以下问题:C# VTDNav.getCurrentIndex方法的具体用法?C# VTDNav.getCurrentIndex怎么用?C# VTDNav.getCurrentIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ximpleware.VTDNav
的用法示例。
在下文中一共展示了VTDNav.getCurrentIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getNameSpaceURI
private String getNameSpaceURI(VTDNav vn)
{
if (argCount1 == 0)
{
try
{
int i = vn.getCurrentIndex();
int type = vn.getTokenType(i);
if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME))
{
int a = vn.lookupNS();
if (a == 0)
return "";
else
return vn.toString(a);
}
return "";
}
catch (Exception e)
{
return "";
}
}
else if (argCount1 == 1 && argumentList.e.NodeSet)
{
vn.push2();
int size = vn.contextStack2.size;
int a = -1;
try
{
a = argumentList.e.evalNodeSet(vn);
}
catch (Exception e)
{
}
String s = "";
// return a;
try
{
if (a == -1 || vn.ns == false)
{ }
else
{
int type = vn.getTokenType(a);
if (type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME)
s = vn.toString(vn.lookupNS());
}
}
catch (Exception e) { };
vn.contextStack2.size = size;
argumentList.e.reset(vn);
vn.pop2();
return s;
}
else
throw new System.ArgumentException
("namespace-uri()'s argument count is invalid");
}
示例2: matchLocalName
private bool matchLocalName(VTDNav vn)
{
if (argCount1 == 1)
{
try
{
int index = vn.getCurrentIndex();
int type = vn.getTokenType(index);
String s1 = argumentList.e.evalString(vn);
if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME))
{
int offset = vn.getTokenOffset(index);
int length = vn.getTokenLength(index);
if (length < 0x10000 || (length >> 16) == 0)
{
return (vn.compareRawTokenString(index, s1) == 0);//vn.toRawString(index);
}
else
{
int preLen = length >> 16;
int QLen = length & 0xffff;
if (preLen != 0)
{
return (vn.compareRawTokenString(offset + preLen + 1, QLen
- preLen - 1, s1) == 0);
}
}
}
else if (type == VTDNav.TOKEN_PI_NAME)
{
return vn.compareRawTokenString(index, s1) == 0;
}
else
return "".Equals(s1);
}
catch (NavException e)
{
return false; // this will never occur
}
}
else if (argCount1 == 2)
{
int a = evalFirstArgumentListNodeSet2(vn);
String s1 = argumentList.next.e.evalString(vn);
if (a == -1 || vn.ns == false)
return "".Equals(s1);
int type = vn.getTokenType(a);
if (type == VTDNav.TOKEN_STARTING_TAG || type == VTDNav.TOKEN_ATTR_NAME)
{
//return "".equals(s1);
try
{
int offset = vn.getTokenOffset(a);
int length = vn.getTokenLength(a);
if (length < 0x10000 || (length >> 16) == 0)
return vn.compareRawTokenString(a, s1) == 0;
else
{
int preLen = length >> 16;
int QLen = length & 0xffff;
if (preLen != 0)
return vn.compareRawTokenString(offset + preLen + 1,
QLen - preLen - 1, s1) == 0;
/*else {
return vn.toRawString(offset, QLen);
}*/
}
}
catch (NavException e)
{
return "".Equals(s1); // this will almost never occur
}
}
else if (type == VTDNav.TOKEN_PI_NAME)
{
try
{
return vn.compareRawTokenString(a, s1) == 0;
}
catch (NavException e)
{
return "".Equals(s1);
}
}
return "".Equals(s1);
}
else
throw new ArgumentException
("match-local-name()'s argument count is invalid");
return false;
}
示例3: getLocalName
private String getLocalName(VTDNav vn)
{
if (argCount1 == 0)
{
try
{
int index = vn.getCurrentIndex();
int type = vn.getTokenType(index);
if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME))
{
int offset = vn.getTokenOffset(index);
int length = vn.getTokenLength(index);
if (length < 0x10000)
{
if (vn.localNameIndex != index)
{
vn.localNameIndex = index;
vn.localName = vn.toRawString(index);
}
return vn.localName;
}
else
{
int preLen = length >> 16;
int QLen = length & 0xffff;
if (preLen != 0)
{
if (vn.localNameIndex != index)
{
vn.localNameIndex = index;
vn.localName = vn.toRawString(offset + preLen + 1, QLen
- preLen - 1);
}
return vn.localName;
}
else
{
if (vn.localNameIndex != index)
{
vn.localNameIndex = index;
vn.localName = vn.toRawString(offset, QLen);
}
return vn.localName;
}
}
}
else
return "";
}
catch (NavException e)
{
return ""; // this will almost never occur
}
}
else if (argCount1 == 1)
{
int a = evalFirstArgumentListNodeSet2(vn);
if (a == -1 || vn.ns == false)
return "";
int type = vn.getTokenType(a);
if (type == VTDNav.TOKEN_STARTING_TAG || type == VTDNav.TOKEN_ATTR_NAME)
{
try
{
int offset = vn.getTokenOffset(a);
int length = vn.getTokenLength(a);
if (length < 0x10000)
return vn.toRawString(a);
else
{
int preLen = length >> 16;
int QLen = length & 0xffff;
if (preLen != 0)
return vn.toRawString(offset + preLen + 1,
QLen - preLen - 1);
else
{
return vn.toRawString(offset, QLen);
}
}
}
catch (NavException e)
{
return ""; // this will almost never occur
}
}
else if (type == VTDNav.TOKEN_PI_NAME)
{
try
{
return vn.toRawString(a);
}
catch (NavException e)
{
return "";
//.........这里部分代码省略.........
示例4: normalizeSpace
private System.String normalizeSpace(VTDNav vn)
{
if (argCount1 == 0)
{
String s = null;
try
{
if (vn.atTerminal)
{
int ttype = vn.getTokenType(vn.LN);
if (ttype == VTDNav.TOKEN_CDATA_VAL)
s = vn.toRawString(vn.LN);
else if (ttype == VTDNav.TOKEN_ATTR_NAME ||
ttype == VTDNav.TOKEN_ATTR_NS)
{
s = vn.toString(vn.LN + 1);
}
else
s = vn.toString(vn.LN);
}
else
{
int i = vn.getCurrentIndex();
int t = vn.getTokenType(i);
if (t == VTDNav.TOKEN_STARTING_TAG || t == VTDNav.TOKEN_DOCUMENT)
{
s = vn.toNormalizedXPathString(i);
}
else
s = vn.toNormalizedString(i);
}
return normalize(s);
}
catch (NavException e)
{
return ""; // this will almost never occur
}
}
else if (argCount1 == 1)
{
String s = "";
if (argumentList.e.NodeSet)
{
//boolean b = false;
int a = evalFirstArgumentListNodeSet(vn);
if (a == -1)
return "";
else
{
try
{
int t = vn.getTokenType(a);
if (t == VTDNav.TOKEN_STARTING_TAG || t == VTDNav.TOKEN_DOCUMENT)
{
s = vn.toNormalizedXPathString(a);
}
else
s = vn.toNormalizedString(a);
}
catch (Exception e)
{
}
return s;
}
}
else
{
s = argumentList.e.evalString(vn);
return normalize(s);
}
}
throw new System.ArgumentException("normalize-space()'s argument count is invalid");
//return null;
}
示例5: matchName
private bool matchName(VTDNav vn)
{
int a;
if (argCount1 == 1)
{
a = vn.getCurrentIndex();
int type = vn.getTokenType(a);
String s1 = argumentList.e.evalString(vn);
if (type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME
|| type == VTDNav.TOKEN_PI_NAME)
{
try
{
return vn.matchRawTokenString(a, s1);
}
catch (Exception e)
{
return false;
}
}
else
return false;
}
else if (argCount1 == 2)
{
a = evalFirstArgumentListNodeSet2(vn);
String s1 = argumentList.next.e.evalString(vn);
try
{
if (a == -1 || vn.ns == false)
return s1.CompareTo("")==0;
else
{
int type = vn.getTokenType(a);
if (type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME
|| type == VTDNav.TOKEN_PI_NAME)
return vn.matchRawTokenString(a, s1);
return false;
}
}
catch (Exception e)
{
}
return false;
}
else
throw new System.ArgumentException(
"matchName()'s argument count is invalid");
}
示例6: process_DDFP2
//.........这里部分代码省略.........
ap.selectFollowingNode();
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.iterate2()) {
if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
&& ((!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) {
state = BACKWARD;
currentStep = currentStep.prevS;
}
} else {
if (currentStep.nextS != null) {
state = FORWARD;
currentStep = currentStep.nextS;
} else {
// vn.pop();
state = TERMINAL;
result = vn.getCurrentIndex();
if (isUnique(result))
return result;
}
}
break;
case END:
currentStep = null;
// reset();
return -1;
case BACKWARD:
if(currentStep.out_of_range){
currentStep.out_of_range = false;
transition_DDFP(vn);
break;
}
// currentStep = currentStep.prevS;
ap = (AutoPilot) currentStep.o;
// vn.push();
//b = false;
while (ap.iterate2()) {
if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
b = true;
break;
}
}
if (b ) {
//if (currentStep.nextS != null) {
// vn.push();
// System.out.println(" --++ push in //");
示例7: process_ancestor2
protected internal int process_ancestor2( VTDNav vn)
{
int result;
bool b = false, b1 = false;
//int contextSize;
Predicate t= null;
switch(state){
case START:
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) {
state = END;
break;
}
state = END;
//if (vn.getCurrentDepth() != -1) {
vn.push2();
while (vn.toNode(VTDNav.P)) {
if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
if (currentStep.nextS != null) {
state = FORWARD;
currentStep = currentStep.nextS;
break;
} else {
//vn.pop();
state = TERMINAL;
result = vn.getCurrentIndex();
if (isUnique(result))
return result;
}
}
}
if (state == END) {
if (currentStep.hasPredicate)
currentStep.resetP(vn);
vn.pop2();
}
// }
break;
case END:
currentStep =null;
// reset();
return -1;
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){
currentStep = currentStep.prevS;
state = BACKWARD;
break;
}
state = BACKWARD;
vn.push2();
while(vn.toNode(VTDNav.P)){
if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
if (currentStep.nextS != null){
state = FORWARD;
currentStep = currentStep.nextS;
break;
}
else {
//vn.pop();
state = TERMINAL;
result = vn.getCurrentIndex();
if ( isUnique(result))
return result;
}
}
}
if ( state == BACKWARD){
if (currentStep.hasPredicate)
//.........这里部分代码省略.........
示例8: getString
private String getString(VTDNav vn){
if (argCount() == 0)
try
{
if (vn.atTerminal)
{
if (vn.getTokenType(vn.LN) == VTDNav.TOKEN_CDATA_VAL)
return vn.toRawString(vn.LN);
return vn.toString(vn.LN);
}
return vn.toString(vn.getCurrentIndex());
}
catch (NavException e)
{
return null; // this will almost never occur
}
else if (argCount() == 1)
{
return argumentList.e.evalString(vn);
}
else
throw new System.ArgumentException("String()'s argument count is invalid");
}
示例9: getLocalName
private String getLocalName(VTDNav vn)
{
if (argCount() == 0)
{
try
{
int index = vn.getCurrentIndex();
int type = vn.getTokenType(index);
if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME))
{
long offset = vn.getTokenOffset(index);
int length = vn.getTokenLength(index);
if (length < 0x10000)
return vn.toRawString(index);
else
{
int preLen = length >> 16;
int QLen = length & 0xffff;
if (preLen != 0)
return vn.toRawString(offset + preLen + 1, QLen
- preLen - 1);
else
{
return vn.toRawString(offset, QLen);
}
}
}
else
return "";
}
catch (NavException e)
{
return ""; // this will almost never occur
}
} else if (argCount() == 1)
{
int a = -1;
vn.push2();
try
{
a = argumentList.e.evalNodeSet(vn);
argumentList.e.reset(vn);
vn.pop2();
}
catch (Exception e)
{
argumentList.e.reset(vn);
vn.pop2();
}
if (a == -1 || vn.ns == false)
return "";
int type = vn.getTokenType(a);
if (type != VTDNav.TOKEN_STARTING_TAG && type != VTDNav.TOKEN_ATTR_NAME)
return "";
try
{
long offset = vn.getTokenOffset(a);
int length = vn.getTokenLength(a);
if (length < 0x10000)
return vn.toRawString(a);
else
{
int preLen = length >> 16;
int QLen = length & 0xffff;
if (preLen != 0)
return vn.toRawString(offset + preLen + 1,
QLen - preLen - 1);
else
{
return vn.toRawString(offset, QLen);
}
}
}
catch (NavException e)
{
return ""; // this will almost never occur
}
}
else
throw new System.ArgumentException
("local-name()'s argument count is invalid");
}
示例10: process_DDFP
//.........这里部分代码省略.........
//System.out.println(" --++ push in //");
b = false;
while (ap.iterate())
{
if (currentStep.evalPredicates(vn))
{
b = true;
break;
}
}
if (b == false)
{
vn.pop2();
//System.out.println(" --++ pop in //");
currentStep.set_ft(true);
currentStep.resetP(vn);
if (state == FORWARD)
{
state = BACKWARD;
currentStep = currentStep.PrevStep;
}
}
else
{
if (currentStep.NextStep != null)
{
state = FORWARD;
currentStep = currentStep.NextStep;
}
else
{
//vn.pop();
state = TERMINAL;
result = vn.getCurrentIndex();
if (isUnique(result))
return result;
}
}
break;
case END:
currentStep = null;
// reset();
return - 1;
case BACKWARD:
//currentStep = currentStep.getPrevStep();
ap = (AutoPilot) currentStep.o;
//vn.push();
b = false;
while (ap.iterate())
{
if (currentStep.evalPredicates(vn))
{
b = true;
break;
}
}
if (b == false)
{
vn.pop2();
currentStep.set_ft(true);
currentStep.resetP(vn);
//System.out.println(" --++ pop in //");
示例11: process_parent
private int process_parent(VTDNav vn)
{
bool b1 = false;
//int contextSize;
Predicate t = null;
int result;
switch (state)
{
case START:
case FORWARD:
t = currentStep.p;
while (t != null)
{
if (t.requireContextSize())
{
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.PrevStep;
}
else
state = END;
break;
}
if (vn.getCurrentDepth() == - 1)
{
if (state == START)
state = END;
else
{
//vn.pop();
state = BACKWARD;
currentStep = currentStep.PrevStep;
}
}
else
{
vn.push2();
vn.toElement(VTDNav.P); // must return true
if (currentStep.eval(vn))
{
if (currentStep.NextStep != null)
{
state = FORWARD;
currentStep = currentStep.NextStep;
}
else
{
state = TERMINAL;
result = vn.getCurrentIndex();
if (isUnique(result))
return result;
}
}
else
{
vn.pop2();
currentStep.resetP(vn);
if (state == START)
state = END;
else
{
state = BACKWARD;
currentStep = currentStep.PrevStep;
}
}
}
break;
case END:
currentStep = null;
// reset();
return - 1;
case BACKWARD:
case TERMINAL:
if (currentStep.PrevStep == null)
{
vn.pop2();
state = END;
break;
}
//.........这里部分代码省略.........
示例12: process_child
private int process_child(VTDNav vn)
{
int result;
bool b = false, b1 = false;
//int contextSize;
Predicate t = null;
switch (state)
{
case START:
if (currentStep.nt.testType != NodeTest.TEXT)
{
// first search for any predicate that
// requires contextSize
// if so, compute its context size
// if size > 0
// set context
// if size ==0
// immediately set the state to backward or end
t = currentStep.p;
while (t != null)
{
if (t.requireContextSize())
{
int i = computeContextSize(t, vn);
if (i == 0)
{
b1 = true;
break;
}
else
t.ContextSize = i;
}
t = t.nextP;
}
if (b1)
{
state = END;
break;
}
b = vn.toElement(VTDNav.FIRST_CHILD);
state = END;
if (b == true)
{
do
{
if (currentStep.eval(vn))
{
if (currentStep.NextStep != null)
{
//currentStep.position++;
state = FORWARD;
currentStep = currentStep.NextStep;
}
else
{
state = TERMINAL;
result = vn.getCurrentIndex();
if (isUnique(result))
{
return result;
}
}
break;
}
}
while (vn.toElement(VTDNav.NS));
if (state == END)
vn.toElement(VTDNav.PARENT);
}
}
else
{
if (vn.AtTerminal == true)
{
state = END;
}
else
{
// compute context size;
t = currentStep.p;
while (t != null)
{
if (t.requireContextSize())
{
int i = computeContextSize(t, vn);
if (i == 0)
{
b1 = true;
break;
}
else
t.ContextSize=i;
}
t = t.nextP;
}
// b1 false indicate context size is zero. no need to go any further...
if (b1)
//.........这里部分代码省略.........
示例13: process_self
private int process_self(VTDNav vn)
{
bool b1 = false;
//int contextSize;
Predicate t = null;
int result;
switch (state)
{
case START:
case FORWARD:
t = currentStep.p;
while (t != null)
{
if (t.requireContextSize())
{
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.PrevStep;
}
else
state = END;
break;
}
if (currentStep.eval(vn))
{
if (currentStep.NextStep != null)
{
state = FORWARD;
currentStep = currentStep.NextStep;
}
else
{
state = TERMINAL;
if (vn.atTerminal == true)
result = vn.LN;
else
result = vn.getCurrentIndex();
if (isUnique(result))
return result;
}
}
else
{
currentStep.resetP(vn);
if (state == START)
state = END;
else
state = BACKWARD;
}
break;
case END:
currentStep = null;
// reset();
return - 1;
case BACKWARD:
case TERMINAL:
if (currentStep.PrevStep != null)
{
state = BACKWARD;
currentStep = currentStep.PrevStep;
}
else
{
state = END;
}
break;
default:
throw new XPathEvalException("unknown state");
}
return - 2;
}
示例14: process_ancestor_or_self
private int process_ancestor_or_self(VTDNav vn)
{
bool b = false, b1 = false;
//int contextSize;
Predicate t = null;
int result;
switch (state)
{
case START:
t = currentStep.p;
while (t != null)
{
if (t.requireContextSize())
{
int i = computeContextSize(t, vn);
if (i == 0)
{
b1 = true;
break;
}
else
t.ContextSize = i;
}
t = t.nextP;
}
if (b1)
{
state = END;
break;
}
state = END;
vn.push2();
if (currentStep.get_ft() == true)
{
currentStep.set_ft(false);
if (currentStep.eval(vn))
{
if (currentStep.NextStep != null)
{
state = FORWARD;
currentStep = currentStep.NextStep;
break;
}
else
{
//vn.pop();
state = TERMINAL;
if (vn.atTerminal)
result = vn.LN;
else
result = vn.getCurrentIndex();
if (isUnique(result))
return result;
}
}
}
while (vn.toElement(VTDNav.P))
{
if (currentStep.eval(vn))
{
if (currentStep.NextStep != null)
{
state = FORWARD;
currentStep = currentStep.NextStep;
break;
}
else
{
//vn.pop();
state = TERMINAL;
result = vn.getCurrentIndex();
if (isUnique(result))
return result;
}
}
}
if (state == END)
{
currentStep.resetP(vn);
vn.pop2();
}
break;
case FORWARD:
t = currentStep.p;
while (t != null)
{
if (t.requireContextSize())
{
int i = computeContextSize(t, vn);
if (i == 0)
{
b1 = true;
break;
//.........这里部分代码省略.........
示例15: getName
private String getName(VTDNav vn)
{
int a;
if (argCount1 == 0)
{
a = vn.getCurrentIndex();
int type = vn.getTokenType(a);
if ((type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME
|| type == VTDNav.TOKEN_PI_NAME))
{
try
{
if (vn.nameIndex != a)
{
vn.name = vn.toRawString(a);
vn.nameIndex = a;
}
return vn.name;
}
catch (Exception e)
{
return "";
}
}
else
return "";
}
else if (argCount1 == 1)
{
a = evalFirstArgumentListNodeSet2(vn);
try
{
if (a == -1 || vn.ns == false)
return "";
else
{
int type = vn.getTokenType(a);
if (type == VTDNav.TOKEN_STARTING_TAG
|| type == VTDNav.TOKEN_ATTR_NAME
|| type == VTDNav.TOKEN_PI_NAME)
return vn.toRawString(a);
return "";
}
}
catch (Exception e)
{
}
return "";
}
else
throw new System.ArgumentException
("name()'s argument count is invalid");
}