本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.xpath.XPath类的典型用法代码示例。如果您正苦于以下问题:Java XPath类的具体用法?Java XPath怎么用?Java XPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XPath类属于com.sun.org.apache.xerces.internal.impl.xpath包,在下文中一共展示了XPath类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: XPathMatcher
import com.sun.org.apache.xerces.internal.impl.xpath.XPath; //导入依赖的package包/类
/**
* Constructs an XPath matcher that implements a document fragment
* handler.
*
* @param xpath The xpath.
*/
public XPathMatcher(XPath xpath) {
fLocationPaths = xpath.getLocationPaths();
fStepIndexes = new IntStack[fLocationPaths.length];
for(int i=0; i<fStepIndexes.length; i++) fStepIndexes[i] = new IntStack();
fCurrentStep = new int[fLocationPaths.length];
fNoMatchDepth = new int[fLocationPaths.length];
fMatched = new int[fLocationPaths.length];
}
示例2: toString
import com.sun.org.apache.xerces.internal.impl.xpath.XPath; //导入依赖的package包/类
/** Returns a string representation of this object. */
public String toString() {
/***
return fLocationPath.toString();
/***/
StringBuffer str = new StringBuffer();
String s = super.toString();
int index2 = s.lastIndexOf('.');
if (index2 != -1) {
s = s.substring(index2 + 1);
}
str.append(s);
for(int i =0;i<fLocationPaths.length; i++) {
str.append('[');
XPath.Step[] steps = fLocationPaths[i].steps;
for (int j = 0; j < steps.length; j++) {
if (j == fCurrentStep[i]) {
str.append('^');
}
str.append(steps[j].toString());
if (j < steps.length - 1) {
str.append('/');
}
}
if (fCurrentStep[i] == steps.length) {
str.append('^');
}
str.append(']');
str.append(',');
}
return str.toString();
}