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

Java AxisIterator类代码示例

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

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



AxisIterator类属于net.sf.saxon.tree.iter包,在下文中一共展示了AxisIterator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getChildElementIndexWithinParent

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
@Override
public int getChildElementIndexWithinParent() {
	final NodeInfo parent = saxonNode.getParent();
	if (parent == null) {
		return -1;
	} else {
		final AxisIterator 	iterator 	= saxonNode.getParent().iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT);
		int index = 1;
		NodeInfo sibling = null;
		do {
			sibling = iterator.next();
			if (saxonNode.getNodeKind() == Type.ELEMENT) {
				if (saxonNode.isSameNodeInfo(sibling)) {
					//logger.info("getChildIndexWithinParent(" + saxonNode.getLocalPart() + "): " + index);
					return index;
				}
				++index;
			}
		}
		while (sibling != null);
	}
	return -1;
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:24,代码来源:SaxonNodeWrapper.java


示例2: noOtherNCNameAttribute

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
@Override
public void noOtherNCNameAttribute(String[] names) throws HttpClientException {
  if (names == null) {
    throw new NullPointerException("the names array is null");
  }
  String[] sorted = new String[names.length];
  for (int i = 0; i < names.length; ++i) {
    sorted[i] = names[i];
  }
  Arrays.sort(sorted);
  String elem_name = myNode.getDisplayName();
  AxisIterator it = myNode.iterateAxis(AxisInfo.ATTRIBUTE);
  NodeInfo attr;
  while ((attr = (NodeInfo) it.next()) != null) {
    String attr_name = attr.getDisplayName();
    if (HttpConstants.HTTP_CLIENT_NS_URI.equals(attr.getURI())) {
      throw new HttpClientException("@" + attr_name + " not allowed on " + elem_name);
    } else if (!"".equals(attr.getURI())) {
      // ignore other-namespace-attributes
    } else if (Arrays.binarySearch(sorted, attr.getLocalPart()) < 0) {
      throw new HttpClientException("@" + attr_name + " not allowed on " + elem_name);
    }
  }
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:25,代码来源:SaxonElement.java


示例3: iterateAxis

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:45,代码来源:RootNode.java


示例4: iterateAxis

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的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


示例5: getAttributeNamesOfNamespace

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的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


示例6: getChildNodes

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
@Override
public List<NodeWrapper> getChildNodes() {
	final AxisIterator 		iterator 	= saxonNode.iterateAxis(AxisInfo.CHILD);
	final List<NodeWrapper>	list		= new LinkedList<>();
	NodeInfo childNode = iterator.next();
	while (childNode != null) {
		list.add(new SaxonNodeWrapper(childNode, xPathCache));
		childNode = iterator.next();
	}
	return list;
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:12,代码来源:SaxonNodeWrapper.java


示例7: getOutputProperties

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
protected Properties getOutputProperties(NodeInfo paramsElem) {
  Properties props = new Properties();
  paramsElem = unwrapNodeInfo(paramsElem);
  AxisIterator iter = paramsElem.iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT);
  NodeInfo paramElem;
  while ((paramElem = iter.next()) != null) {
    props.put(paramElem.getLocalPart(), paramElem.getAttributeValue("", "value"));
  }  
  return props;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:11,代码来源:ExtensionFunctionCall.java


示例8: getAttribute

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的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


示例9: httpNsChildren

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的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


示例10: filteredSingleton

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的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


示例11: iterateAxis

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:57,代码来源:ElementNode.java


示例12: getRootElement

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
@Override
public NodeWrapper getRootElement() {
	final AxisIterator 	iterator 	= saxonNode.getDocumentRoot().iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT);
	return new SaxonNodeWrapper(iterator.next(), xPathCache);
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:6,代码来源:SaxonNodeWrapper.java


示例13: parseNode

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
private void parseNode(NodeInfo node, TopicRefContainer parentTopicRefContainer, String parentTopicId) throws TransformerException {
	//logger.info("parseNode: " + node/*.getUnderlyingNode()*/.getDisplayName() + ", " + node.getNodeKind());
	//if (node.getNodeKind() == XdmNodeKind.ELEMENT) {
	if (node.getNodeKind() == Type.ELEMENT) {
		
		final SaxonNodeWrapper nodeWrapper = new SaxonNodeWrapper(node/*.getUnderlyingNode()*/, bookCache.getXPathCache());
		
		final KeyDef keyDef = KeyDef.fromNode(nodeWrapper, parentTopicId);
		if (keyDef != null) {
			keyDefList.add(keyDef);
			bookCache.addKeyDef(keyDef);
		}
		
		final XsltConref xsltConref = XsltConref.fromNode(nodeWrapper, xsltConrefCache);
		if (xsltConref != null) {
			processXsltConref(xsltConref, parentTopicRefContainer, parentTopicId);
		}
		
		final String classAttr = nodeWrapper.getAttribute(DitaUtil.ATTR_CLASS, null);

		//logger.info("parsing element: <" + nodeWrapper.getName() + " class=\"" + classAttr + "\">");

		if (classAttr != null) {
			final TopicRef topicRef = parseTopicRef(nodeWrapper, classAttr, parentTopicRefContainer);
			if (topicRef != null) {
				parentTopicRefContainer = topicRef;	// take it as new parent for child nodes.
			}
			parseKeyTypeDefNode(nodeWrapper, classAttr);
			
			final String id = nodeWrapper.getAttribute(DitaUtil.ATTR_ID, null);
			if ((id != null) && (!id.isEmpty())) {
				if (classAttr.contains(DitaUtil.CLASS_TOPIC)) {
					addElementId(nodeWrapper, null, id);
					parentTopicId = id;
				} else {
					addElementId(nodeWrapper, parentTopicId, id);
				}
			}
		}

		final AxisIterator 	iterator 	= node.iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT);
		NodeInfo child = iterator.next();
		while (child != null) {
			parseNode(child, parentTopicRefContainer, parentTopicId);
			child = iterator.next();
		}
	}
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:49,代码来源:FileCache.java


示例14: createNodeFromNodeInfo

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
public static Node createNodeFromNodeInfo(NodeInfo nodeInfo, 
    Document doc, DiffXML.WhitespaceStrippingPolicy whitespaceHandling) {
  Node node = null;
  switch (nodeInfo.getNodeKind()) {
  case Type.TEXT:
    String content = nodeInfo.getStringValue();
    boolean isWhitespace = Whitespace.isWhite(content);
    if (isWhitespace && whitespaceHandling.equals(DiffXML.WhitespaceStrippingPolicy.ALL)) {
      break;
    }
    node = doc.createTextNode(content);
    break;
  case Type.WHITESPACE_TEXT:
    content = nodeInfo.getStringValue();
    if (whitespaceHandling.equals(DiffXML.WhitespaceStrippingPolicy.ALL)) {
      node = doc.createTextNode(content);
    }
    break;
  case Type.ELEMENT:
    if (nodeInfo.getURI().equals("")) {
      node = doc.createElement(nodeInfo.getLocalPart());
    } else {
      node = doc.createElementNS(nodeInfo.getURI(), nodeInfo.getLocalPart());
    }
    
    AxisIterator namespaces = nodeInfo.iterateAxis(AxisInfo.NAMESPACE);
    NodeInfo ns;
    while ((ns = namespaces.next()) != null) {
      String localPart = ns.getLocalPart();
      String qualifiedName;
      if (localPart.equals(""))
        qualifiedName = "xmlns";
      else
        qualifiedName = "xmlns:" + localPart;
      ((Element) node).setAttributeNS("http://www.w3.org/2000/xmlns/", qualifiedName, ns.getStringValue());
    }
    
    AxisIterator attrs = nodeInfo.iterateAxis(AxisInfo.ATTRIBUTE);
    NodeInfo attr;
    while ((attr = attrs.next()) != null) {
      if (attr.getURI().equals("")) {
        ((Element) node).setAttribute(attr.getLocalPart(), attr.getStringValue());
      } else if (attr.getURI().equals(Definitions.NAMESPACEURI_DELTAXML) && attr.getLocalPart().equals("whitespace")) {
        String value = attr.getStringValue();
        try {
          whitespaceHandling = WhitespaceStrippingPolicy.valueOf(value);
        } catch (Exception e) {
          throw new XSLWebException("Value for whitespace handling not supported: \"" + value + "\"");
        }
      } else {
        ((Element) node).setAttributeNS(attr.getURI(), attr.getPrefix() + ":" + attr.getLocalPart(), attr.getStringValue());
      }
    }
    
    break;
  /*
  case Type.COMMENT:
    treeNode = new CommentNode(nodeInfo.getStringValue());
    break;
  case Type.PROCESSING_INSTRUCTION:
    treeNode = new ProcessingInstructionNode(nodeInfo.getStringValue()); // TODO
    break;
  */
  }
  
  if (node != null && nodeInfo.hasChildNodes()) {
    AxisIterator childs = nodeInfo.iterateAxis(AxisInfo.CHILD);
    NodeInfo childNodeInfo;
    while ((childNodeInfo = childs.next()) != null) {
      Node newNode = createNodeFromNodeInfo(childNodeInfo, doc, whitespaceHandling);
      if (newNode != null) {
        node.appendChild(newNode);
      }
    }
  }
  
  return node;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:79,代码来源:DiffUtils.java


示例15: attributes

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
@Override
public Iterable<Attribute> attributes() {
  AxisIterator it = myNode.iterateAxis(AxisInfo.ATTRIBUTE);
  return new AttributeIterable(it);
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:6,代码来源:SaxonElement.java


示例16: children

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
@Override
public Iterable<Element> children() throws HttpClientException {
  AxisIterator it = myNode.iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT);
  return new ElemIterable(it);
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:6,代码来源:SaxonElement.java


示例17: AttributeIterable

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
public AttributeIterable(AxisIterator it) {
  myIter = new AttributeIteratorWrapper(it);
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:4,代码来源:SaxonElement.java


示例18: AttributeIteratorWrapper

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
public AttributeIteratorWrapper(AxisIterator it) {
  myIter = it;
  myNext = (NodeInfo) it.next();
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:5,代码来源:SaxonElement.java


示例19: ElemIterable

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
public ElemIterable(AxisIterator it) {
  myIter = new ElemIteratorWrapper(it);
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:4,代码来源:SaxonElement.java


示例20: ElemIteratorWrapper

import net.sf.saxon.tree.iter.AxisIterator; //导入依赖的package包/类
public ElemIteratorWrapper(AxisIterator it) {
  myIter = it;
  myNext = (NodeInfo) it.next();
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:5,代码来源:SaxonElement.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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