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


Java NodeInfo.getParent方法代码示例

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


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

示例1: initializeNodeInfo

import net.sf.saxon.om.NodeInfo; //导入方法依赖的package包/类
private void initializeNodeInfo(@Nullable NodeInfo nodeInfo) {
    if (nodeInfo == null) {
        return;
    }

    int nodeKind = nodeInfo.getNodeKind();
    NodeInfo elemInfo = null;

    if (nodeKind == Type.ATTRIBUTE) {
        this.attrQname = new QName(nodeInfo.getPrefix(), nodeInfo.getURI(), nodeInfo.getLocalPart());

        elemInfo = nodeInfo.getParent();
    } else if (nodeKind == Type.ELEMENT) {
        elemInfo = nodeInfo;
    }

    if (elemInfo == null) {
        return;
    }

    this.elemQname = new QName(elemInfo.getPrefix(), elemInfo.getURI(), elemInfo.getLocalPart());
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:23,代码来源:SdcctLocation.java

示例2: selectID

import net.sf.saxon.om.NodeInfo; //导入方法依赖的package包/类
/**
 * Get the element with a given ID, if any
 * 
 * @param id
 *            the required ID value
 * @param getParent
 *            true if running the element-with-id() function rather than the id()
 *            function; the difference is that in the case of an element of type xs:ID,
 *            the parent of the element should be returned, not the element itself.
 * @return the element with the given ID, or null if there is no such ID
 *         present (or if the parser has not notified attributes as being of
 *         type ID).
 */

public NodeInfo selectID(String id, boolean getParent) {
	if (idIndex == null) {
		Element elem;
		switch (nodeKind) {
			case Type.DOCUMENT : 
				elem = ((Document) node).getRootElement();
				break;
			case Type.ELEMENT : 
				elem = (Element) node;
				break;
			default: 
				return null;
		}
		idIndex = new HashMap(50);
		buildIDIndex(elem);
	}

	NodeInfo result = (NodeInfo) idIndex.get(id);

	if (result != null && getParent && result.isId() && result.getStringValue().equals(id)) {
           result = result.getParent();
       }

	return result ;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:40,代码来源:DocumentWrapper.java

示例3: 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

示例4: parent

import net.sf.saxon.om.NodeInfo; //导入方法依赖的package包/类
@Override
public NodeInfo parent(NodeInfo node){
    return node.getParent();
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:5,代码来源:SaxonEngine.java


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