本文整理汇总了Java中net.sf.saxon.pattern.NodeTest类的典型用法代码示例。如果您正苦于以下问题:Java NodeTest类的具体用法?Java NodeTest怎么用?Java NodeTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeTest类属于net.sf.saxon.pattern包,在下文中一共展示了NodeTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasNoNsChild
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
@Override
public boolean hasNoNsChild() throws HttpClientException {
NamePool pool = myNode.getConfiguration().getNamePool();
NodeTest no_ns_pred = new NamespaceTest(pool, Type.ELEMENT, "");
return myNode.iterateAxis(AxisInfo.CHILD, no_ns_pred).next() != null;
}
示例2: processArc
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
void processArc(PathMapArc arc) {
NodeTest test = arc.getNodeTest();
if (test == null) {
addAnyNodeArc(arc);
} else {
switch (test.getPrimitiveType()) {
case Type.TEXT:
matchesText = true;
case Type.NODE:
addAnyNodeArc(arc);
break;
case Type.COMMENT:
matchesComment = true;
break;
case Type.ELEMENT:
addElementArc(arc);
break;
case Type.ATTRIBUTE:
addAttributeArc(arc);
break;
}
}
}
示例3: 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$
}
}
示例4: 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;
}
}
}
}
示例5: ChildAxisIterator
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
private ChildAxisIterator(NodeWrapper start, boolean downwards, boolean forwards, NodeTest test) {
this.start = start;
this.downwards = downwards;
this.forwards = forwards;
if (test == AnyNodeTest.getInstance()) test = null;
this.nodeTest = test;
this.position = 0;
if (downwards)
commonParent = start;
else
commonParent = (NodeWrapper) start.getParent();
par = (ParentNode) commonParent.node;
if (downwards) {
ix = (forwards ? 0 : par.getChildCount());
} else {
// find the start node among the list of siblings
// ix = start.getSiblingPosition();
ix = par.indexOf(start.node);
if (forwards) ix++;
}
cursor = ix;
if (!downwards && !forwards) ix--;
}
示例6: FollowingEnumeration
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
public FollowingEnumeration(NodeImpl node, NodeTest nodeTest)
{
super(node, nodeTest);
root = (LazyDocument)node.getDocumentRoot();
// skip the descendant nodes if any
int type = node.getNodeKind();
if (type == Type.ATTRIBUTE || type == Type.NAMESPACE)
{
next = ((NodeImpl)node.getParent()).getNextInDocument(root);
}
else {
do {
next = (NodeImpl)node.getNextSibling();
if (next == null)
node = (NodeImpl)node.getParent();
} while (next == null && node != null);
}
while (!conforms(next)) {
step();
}
}
示例7: DescendantEnumeration
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
public DescendantEnumeration(NodeImpl node, NodeTest nodeTest,
boolean includeSelf)
{
super(node, nodeTest);
root = node;
this.includeSelf = includeSelf;
if (!includeSelf || !conforms(node)) {
advance();
}
}
示例8: iterateAxis
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
/**
* Determines axis iteration algorithm.
* @param axisNumber element from {@code AxisInfo}
* @param nodeTest filter for iterator
* @return {@code AxisIterator} object
*/
@Override
public AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest) {
AxisIterator axisIterator = iterateAxis(axisNumber);
if (nodeTest != null) {
axisIterator = new Navigator.AxisFilter(axisIterator, nodeTest);
}
return axisIterator;
}
示例9: getAttributeNamesOfNamespace
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
@Override
public List<String> getAttributeNamesOfNamespace(String namespaceUri) {
final List<String> list = new LinkedList<String>();
if (isElement()) {
final NodeTest nodeTest = new NamespaceTest(saxonNode.getNamePool(), Type.ATTRIBUTE, namespaceUri);
final AxisIterator iterator = saxonNode.iterateAxis(AxisInfo.ATTRIBUTE, nodeTest);
NodeInfo attribute = iterator.next();
while (attribute != null) {
list.add(attribute.getLocalPart());
attribute = iterator.next();
}
}
return list;
}
示例10: getAttribute
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
@Override
public String getAttribute(String local_name) throws HttpClientException {
// get the attribute
NamePool pool = myNode.getConfiguration().getNamePool();
NodeTest pred = new NameTest(Type.ATTRIBUTE, "", local_name, pool);
AxisIterator attrs = myNode.iterateAxis(AxisInfo.ATTRIBUTE, pred);
NodeInfo a = (NodeInfo) attrs.next();
// return its string value, or null if there is no such attribute
if (a == null) {
return null;
} else {
return a.getStringValue();
}
}
示例11: httpNsChildren
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
@Override
public Iterable<Element> httpNsChildren() throws HttpClientException {
String http_ns = HttpConstants.HTTP_CLIENT_NS_URI;
NamePool pool = myNode.getConfiguration().getNamePool();
NodeTest pred = new NamespaceTest(pool, Type.ELEMENT, http_ns);
AxisIterator it = myNode.iterateAxis(AxisInfo.CHILD, pred);
return new ElemIterable(it);
}
示例12: AncestorAxisIterator
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
public AncestorAxisIterator(NodeWrapper start, boolean includeSelf, NodeTest test) {
// use lazy instead of eager materialization (performance)
this.start = start;
if (test == AnyNodeTest.getInstance()) test = null;
this.nodeTest = test;
if (!includeSelf) this.current = start;
this.includeSelf = includeSelf;
this.position = 0;
}
示例13: AttributeAxisIterator
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
public AttributeAxisIterator(NodeWrapper start, NodeTest test) {
// use lazy instead of eager materialization (performance)
this.start = start;
if (test == AnyNodeTest.getInstance()) test = null;
this.nodeTest = test;
this.position = 0;
this.cursor = 0;
}
示例14: DescendantAxisIterator
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
public DescendantAxisIterator(NodeWrapper start, boolean includeSelf, boolean following, NodeTest test) {
this.start = start;
this.includeSelf = includeSelf;
this.following = following;
this.moveToNextSibling = following;
if (!following) anchor = start.node;
if (!includeSelf) currNode = start.node;
if (test == AnyNodeTest.getInstance()) { // performance hack
test = null; // mark as AnyNodeTest
}
else if (test instanceof NameTest) {
NameTest nt = (NameTest) test;
if (nt.getPrimitiveType() == Type.ELEMENT) { // performance hack
// mark as element name test
NamePool pool = getNamePool();
this.testLocalName = pool.getLocalName(nt.getFingerprint());
this.testURI = pool.getURI(nt.getFingerprint());
}
}
else if (test instanceof NodeKindTest) {
if (test.getPrimitiveType() == Type.ELEMENT) { // performance hack
// mark as element type test
this.testLocalName = "";
this.testURI = null;
}
}
this.nodeTest = test;
this.position = 0;
}
示例15: PrecedingAxisIterator
import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
public PrecedingAxisIterator(NodeWrapper start, boolean includeAncestors, NodeTest test) {
this.start = start;
this.includeAncestors = includeAncestors;
this.currNode = start.node;
if (includeAncestors)
nextAncestor = null;
else
nextAncestor = start.node.getParent();
if (test == AnyNodeTest.getInstance()) { // performance hack
test = null; // mark as AnyNodeTest
}
else if (test instanceof NameTest) {
NameTest nt = (NameTest) test;
if (nt.getPrimitiveType() == Type.ELEMENT) { // performance hack
// mark as element name test
NamePool pool = getNamePool();
this.testLocalName = pool.getLocalName(nt.getFingerprint());
this.testURI = pool.getURI(nt.getFingerprint());
}
}
else if (test instanceof NodeKindTest) {
if (test.getPrimitiveType() == Type.ELEMENT) { // performance hack
// mark as element type test
this.testLocalName = "";
this.testURI = null;
}
}
this.nodeTest = test;
this.position = 0;
}