本文整理汇总了Java中net.sf.saxon.pattern.NodeTest.matches方法的典型用法代码示例。如果您正苦于以下问题:Java NodeTest.matches方法的具体用法?Java NodeTest.matches怎么用?Java NodeTest.matches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.saxon.pattern.NodeTest
的用法示例。
在下文中一共展示了NodeTest.matches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startElement
import net.sf.saxon.pattern.NodeTest; //导入方法依赖的package包/类
@Override
public void startElement(NodeName elemName, SchemaType typeCode,
int locationId, int properties) throws XPathException {
MatchContext mc = matchContext.getLast();
MatchContext newContext = new MatchContext();
if (mc.elementArcs != null) {
for (PathMapArc arc : mc.elementArcs) {
NodeTest test = arc.getNodeTest();
if (test == null || test.matches(Type.ELEMENT, elemName, typeCode.getFingerprint())) {
newContext.bulidContext(arc.getTarget());
newContext.matchedElement = true;
}
if (arc.getAxis() == AxisInfo.DESCENDANT || arc.getAxis() == AxisInfo.DESCENDANT_OR_SELF) {
newContext.processArc(arc);
}
}
}
matchContext.add(newContext);
if (newContext.matchedElement) {
super.startElement(elemName, typeCode, locationId, properties);
} else if (logTrace) {
LogManager.logTrace(LogConstants.CTX_RUNTIME, "Document projection did not match element", elemName.getURI(), ':', elemName.getLocalPart()); //$NON-NLS-1$
}
}
示例2: attribute
import net.sf.saxon.pattern.NodeTest; //导入方法依赖的package包/类
@Override
public void attribute(NodeName nameCode, SimpleType typeCode,
CharSequence value, int locationId, int properties)
throws XPathException {
MatchContext mc = matchContext.getLast();
if (!mc.matchedElement) {
return;
}
if (nameCode.isInNamespace(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI)) {
super.attribute(nameCode, typeCode, value, locationId, properties);
return;
}
if (mc.attributeArcs != null) {
for (PathMapArc arc : mc.attributeArcs) {
NodeTest test = arc.getNodeTest();
if (test == null || test.matches(Type.ATTRIBUTE, nameCode, typeCode.getFingerprint())) {
super.attribute(nameCode, typeCode, value, locationId, properties);
return;
}
}
}
}
示例3: filteredSingleton
import net.sf.saxon.pattern.NodeTest; //导入方法依赖的package包/类
private static AxisIterator filteredSingleton(NodeInfo node, NodeTest nodeTest) {
// return Navigator.filteredSingleton(node, nodeTest); // saxon >= 8.7
if (node != null && (nodeTest == AnyNodeTest.getInstance() || nodeTest.matches(node))) {
return SingleNodeIterator.makeIterator(node);
} else {
return EMPTY_AXIS_ITERATOR;
}
}