当前位置: 首页>>代码示例>>Java>>正文


Java NodeTest类代码示例

本文整理汇总了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;
}
 
开发者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


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