本文整理汇总了Java中net.sf.saxon.om.AxisInfo.DESCENDANT_OR_SELF属性的典型用法代码示例。如果您正苦于以下问题:Java AxisInfo.DESCENDANT_OR_SELF属性的具体用法?Java AxisInfo.DESCENDANT_OR_SELF怎么用?Java AxisInfo.DESCENDANT_OR_SELF使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.sf.saxon.om.AxisInfo
的用法示例。
在下文中一共展示了AxisInfo.DESCENDANT_OR_SELF属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startElement
@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: iterateAxis
/**
* Determines axis iteration algorithm. Throws {@code UnsupportedOperationException} in case,
* when there is no axis iterator for given axisNumber.
* @param axisNumber element from {@code AxisInfo}
* @return {@code AxisIterator} object
*/
@Override
public AxisIterator iterateAxis(byte axisNumber) {
final AxisIterator result;
switch (axisNumber) {
case AxisInfo.ANCESTOR:
case AxisInfo.ATTRIBUTE:
case AxisInfo.PARENT:
result = EmptyIterator.OfNodes.THE_INSTANCE;
break;
case AxisInfo.ANCESTOR_OR_SELF:
case AxisInfo.SELF:
result = SingleNodeIterator.makeIterator(this);
break;
case AxisInfo.CHILD:
if (hasChildNodes()) {
result = new ArrayIterator.OfNodes(
getChildren().toArray(new AbstractNode[getChildren().size()]));
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT:
if (hasChildNodes()) {
result = new Navigator.DescendantEnumeration(this, false, true);
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT_OR_SELF:
result = new Navigator.DescendantEnumeration(this, true, true);
break;
default:
throw throwUnsupportedOperationException();
}
return result;
}
示例3: getAxisType
private AxisType getAxisType(byte axis) {
switch (axis) {
case AxisInfo.ANCESTOR:
return AxisType.ANCESTOR;
case AxisInfo.ANCESTOR_OR_SELF:
return AxisType.ANCESTOR_OR_SELF;
case AxisInfo.ATTRIBUTE:
return AxisType.ATTRIBUTE;
case AxisInfo.CHILD:
return AxisType.CHILD;
case AxisInfo.DESCENDANT:
return AxisType.DESCENDANT;
case AxisInfo.DESCENDANT_OR_SELF:
return AxisType.DESCENDANT_OR_SELF;
case AxisInfo.FOLLOWING:
return AxisType.FOLLOWING;
case AxisInfo.FOLLOWING_SIBLING:
return AxisType.FOLLOWING_SIBLING;
case AxisInfo.NAMESPACE:
return AxisType.NAMESPACE;
case AxisInfo.PARENT:
return AxisType.PARENT;
case AxisInfo.PRECEDING:
return AxisType.PRECEDING;
case AxisInfo.PRECEDING_OR_ANCESTOR:
return null; // ??
case AxisInfo.PRECEDING_SIBLING:
return AxisType.PRECEDING_SIBLING;
case AxisInfo.SELF:
return AxisType.SELF;
}
return null;
}
示例4: iterateAxis
/**
* Determines axis iteration algorithm. Throws {@code UnsupportedOperationException} in case,
* when there is no axis iterator for given axisNumber.
*
* @param axisNumber element from {@code AxisInfo}
* @return {@code AxisIterator} object
*/
@Override
public AxisIterator iterateAxis(byte axisNumber) {
final AxisIterator result;
switch (axisNumber) {
case AxisInfo.ANCESTOR:
result = new Navigator.AncestorEnumeration(this, false);
break;
case AxisInfo.ANCESTOR_OR_SELF:
result = new Navigator.AncestorEnumeration(this, true);
break;
case AxisInfo.ATTRIBUTE:
if (attributes == null) {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
else {
result = new ArrayIterator.OfNodes(attributes);
}
break;
case AxisInfo.CHILD:
if (hasChildNodes()) {
result = new ArrayIterator.OfNodes(
getChildren().toArray(new AbstractNode[getChildren().size()]));
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT:
if (hasChildNodes()) {
result = new Navigator.DescendantEnumeration(this, false, true);
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT_OR_SELF:
result = new Navigator.DescendantEnumeration(this, true, true);
break;
case AxisInfo.PARENT:
result = SingleNodeIterator.makeIterator(parent);
break;
case AxisInfo.SELF:
result = SingleNodeIterator.makeIterator(this);
break;
default:
throw throwUnsupportedOperationException();
}
return result;
}