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


Java NodeInfo.iterateAxis方法代码示例

本文整理汇总了Java中net.sf.saxon.om.NodeInfo.iterateAxis方法的典型用法代码示例。如果您正苦于以下问题:Java NodeInfo.iterateAxis方法的具体用法?Java NodeInfo.iterateAxis怎么用?Java NodeInfo.iterateAxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.saxon.om.NodeInfo的用法示例。


在下文中一共展示了NodeInfo.iterateAxis方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOutputProperties

import net.sf.saxon.om.NodeInfo; //导入方法依赖的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

示例2: parseNode

import net.sf.saxon.om.NodeInfo; //导入方法依赖的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

示例3: createNodeFromNodeInfo

import net.sf.saxon.om.NodeInfo; //导入方法依赖的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

示例4: buildSegments

import net.sf.saxon.om.NodeInfo; //导入方法依赖的package包/类
private static LinkedList<ContentPathSegment<?, ?>> buildSegments(LinkedList<ContentPathSegment<?, ?>> segments, NodeInfo nodeInfo,
    @Nullable String nsPrefix, @Nullable String nsUri, String localName) {
    boolean attrNode = (nodeInfo.getNodeKind() == Type.ATTRIBUTE);

    if (attrNode) {
        segments.add(0, new AttributePathSegmentImpl(nsPrefix, nsUri, localName));
    }

    ElementPathSegment elemSegment = new ElementPathSegmentImpl(nsPrefix, nsUri, localName);
    segments.add(0, elemSegment);

    NodeInfo parentNodeInfo = nodeInfo.getParent();

    if ((parentNodeInfo != null) && (parentNodeInfo.getNodeKind() != Type.DOCUMENT)) {
        if (!attrNode) {
            int nodeIndex = -1;
            SameNameTest siblingNodeTest = new SameNameTest(nodeInfo);
            AxisIterator precedingSiblingNodeIterator = nodeInfo.iterateAxis(AxisInfo.PRECEDING_SIBLING, siblingNodeTest);

            while (precedingSiblingNodeIterator.next() != null) {
                nodeIndex++;
            }

            if (nodeIndex == -1) {
                if (nodeInfo.iterateAxis(AxisInfo.FOLLOWING_SIBLING, siblingNodeTest).next() != null) {
                    nodeIndex = 0;
                }
            } else {
                nodeIndex++;
            }

            if (nodeIndex >= 0) {
                elemSegment.setIndex(nodeIndex);
            }
        }

        buildSegments(segments, parentNodeInfo, parentNodeInfo.getPrefix(), parentNodeInfo.getURI(), parentNodeInfo.getLocalPart());
    }

    return segments;
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:42,代码来源:ContentPathBuilderImpl.java

示例5: NodeInfoSequence

import net.sf.saxon.om.NodeInfo; //导入方法依赖的package包/类
NodeInfoSequence(NodeInfo nodeInfo, byte axis){
    this.nodeInfo = nodeInfo;
    this.axis = axis;
    iterator = nodeInfo.iterateAxis(axis);
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:6,代码来源:SaxonEngine.java


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