• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NodeTest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.sf.saxon.pattern.NodeTest的典型用法代码示例。如果您正苦于以下问题:Java NodeTest类的具体用法?Java NodeTest怎么用?Java NodeTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NodeTest类属于net.sf.saxon.pattern包,在下文中一共展示了NodeTest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:7,代码来源:SaxonElement.java


示例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;
		}
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:24,代码来源:PathMapFilter.java


示例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$
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:PathMapFilter.java


示例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;
			} 
		}
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:23,代码来源:PathMapFilter.java


示例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--;
		}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:27,代码来源:NodeWrapper.java


示例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();
  }
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:23,代码来源:FollowingEnumeration.java


示例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();
  }
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:11,代码来源:DescendantEnumeration.java


示例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;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:15,代码来源:AbstractNode.java


示例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;
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:15,代码来源:SaxonNodeWrapper.java


示例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();
  }
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:15,代码来源:SaxonElement.java


示例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);
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:9,代码来源:SaxonElement.java


示例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;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:10,代码来源:NodeWrapper.java


示例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;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:9,代码来源:NodeWrapper.java


示例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;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:32,代码来源:NodeWrapper.java


示例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;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:32,代码来源:NodeWrapper.java


示例16: 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;
        }
    }
 
开发者ID:kenweezy,项目名称:teiid,代码行数:9,代码来源:NodeWrapper.java


示例17: iterateAxis

import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
/**
 * Return an enumeration over the nodes reached by the given axis from this
 * node
 *
 * @param axisNumber The axis to be iterated over
 * @param nodeTest A pattern to be matched by the returned nodes
 * @return an AxisIterator that scans the nodes reached by the axis in turn.
 */
public AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest) 
{
  // Make sure our special attribute has been added before allowing access
  // to the attributes.
  //
  if (axisNumber == Axis.ATTRIBUTE)
    addSpecialAttrib();

  // That done, we just do the normal thing.
  return super.iterateAxis(axisNumber, nodeTest);
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:20,代码来源:SearchElementImpl.java


示例18: AttributeEnumeration

import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
/**
* Constructor
* @param node the element whose attributes are required. This may be any type of node,
* but if it is not an element the enumeration will be empty
* @param nodeTest condition to be applied to the names of the attributes selected
*/
public AttributeEnumeration(NodeImpl node, NodeTest nodeTest) 
{
  this.nodeTest = nodeTest;

  if (node.getNodeKind() == Type.ELEMENT) 
  {
    element = (ElementImpl)node;

    if (element.attrNames == null)
      return;

    if (nodeTest instanceof NameTest) 
    {
      NameTest test = (NameTest)nodeTest;
      int fingerprint = test.getFingerprint();
      for (int i = 0; i < element.attrNames.length; i++) 
      {
        if ((element.attrNames[i] & 0xfffff) == fingerprint) {
          next = new AttributeImpl(element, i);
          return;
        }
      }

      next = null;
    }
    else {
      length = element.attrNames.length;
      advance();
    }
  }
  else { // if it's not an element, or if we're not looking for attributes,

           // then there's nothing to find
    next = null;
    index = 0;
    length = 0;
  }
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:45,代码来源:AttributeEnumeration.java


示例19: AncestorEnumeration

import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
public AncestorEnumeration(NodeImpl node, NodeTest nodeTest,
                           boolean includeSelf) 
{
  super(node, nodeTest);
  this.includeSelf = includeSelf;
  if (!includeSelf || !conforms(node)) {
    advance();
  }
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:10,代码来源:AncestorEnumeration.java


示例20: iterateAxis

import net.sf.saxon.pattern.NodeTest; //导入依赖的package包/类
/**
 * Return an enumeration over the nodes reached by the given axis from this node
 *
 * @param axisNumber The axis to be iterated over
 * @param nodeTest   A pattern to be matched by the returned nodes
 * @return an AxisIterator that scans the nodes reached by the axis in turn.
 */
public AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest) 
{
  switch (axisNumber) 
  {
    case Axis.ANCESTOR:
      return new AncestorEnumeration(this, nodeTest, false);
    case Axis.ANCESTOR_OR_SELF:
      return new AncestorEnumeration(this, nodeTest, true);
    case Axis.ATTRIBUTE:
      if (this.getNodeKind() != Type.ELEMENT) 
    {
        return EmptyIterator.getInstance();
      }
      return new AttributeEnumeration(this, nodeTest);
    case Axis.CHILD:
      if (this instanceof ParentNodeImpl) 
    {
        return ((ParentNodeImpl)this).enumerateChildren(nodeTest);
      }
      else {
        return EmptyIterator.getInstance();
      }
    case Axis.DESCENDANT:
      if (getNodeKind() == Type.DOCUMENT &&
          nodeTest instanceof NameTest &&
          nodeTest.getPrimitiveType() == Type.ELEMENT) 
      {
        return ((LazyDocument)this).getAllElements(nodeTest.getFingerprint());
      }
      else if (hasChildNodes()) {
        return new DescendantEnumeration(this, nodeTest, false);
      }
      else {
        return EmptyIterator.getInstance();
      }
    case Axis.DESCENDANT_OR_SELF:
      return new DescendantEnumeration(this, nodeTest, true);
    case Axis.FOLLOWING:
      return new FollowingEnumeration(this, nodeTest);
    case Axis.FOLLOWING_SIBLING:
      return new FollowingSiblingEnumeration(this, nodeTest);
    case Axis.NAMESPACE:
      if (this.getNodeKind() != Type.ELEMENT) 
    {
        return EmptyIterator.getInstance();
      }
      return NamespaceIterator.makeIterator(this, nodeTest);
    case Axis.PARENT:
      NodeInfo parent = getParent();
      if (parent == null) {
        return EmptyIterator.getInstance();
      }
      return Navigator.filteredSingleton(parent, nodeTest);
    case Axis.PRECEDING:
      return new PrecedingEnumeration(this, nodeTest);
    case Axis.PRECEDING_SIBLING:
      return new PrecedingSiblingEnumeration(this, nodeTest);
    case Axis.SELF:
      return Navigator.filteredSingleton(this, nodeTest);
    case Axis.PRECEDING_OR_ANCESTOR:
      return new PrecedingOrAncestorEnumeration(this, nodeTest);
    default:
      throw new IllegalArgumentException("Unknown axis number " + axisNumber);
  }
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:73,代码来源:NodeImpl.java



注:本文中的net.sf.saxon.pattern.NodeTest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PolynomialRingGF2m类代码示例发布时间:2022-05-23
下一篇:
Java Predicate类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap