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


Java XMLObject.getParent方法代码示例

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


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

示例1: prepareForAdoption

import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
 * Prepares the given DOM caching XMLObject for adoption into another document. If the XMLObject has a parent then
 * all visible namespaces used by the given XMLObject and its descendants are declared within that subtree and the
 * parent's DOM is invalidated.
 * 
 * @param domCachingObject the XMLObject to prepare for adoption
 * 
 * @throws MarshallingException thrown if a namespace within the XMLObject's DOM subtree can not be resolved.
 */
private void prepareForAdoption(XMLObject domCachingObject) throws MarshallingException {
    if (domCachingObject.getParent() != null) {
        log.trace("Rooting all visible namespaces of XMLObject {} before adding it to new parent Element",
                domCachingObject.getElementQName());
        try {
            XMLHelper.rootNamespaces(domCachingObject.getDOM());
        } catch (XMLParserException e) {
            String errorMsg =
                    "Unable to root namespaces of cached DOM element, " + domCachingObject.getElementQName();
            log.error(errorMsg, e);
            throw new MarshallingException(errorMsg, e);
        }

        log.trace("Release DOM of XMLObject parent");
        domCachingObject.releaseParentDOM(true);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:AbstractXMLObjectMarshaller.java

示例2: isValid

import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
 * Checks to see if the given XMLObject is still valid. An XMLObject is valid if, and only if, itself and every
 * ancestral {@link TimeBoundSAMLObject} is valid.
 * 
 * @param xmlObject the XML object tree to check
 * 
 * @return true of the tree is valid, false if not
 */
public static boolean isValid(XMLObject xmlObject) {
    if (xmlObject instanceof TimeBoundSAMLObject) {
        TimeBoundSAMLObject timeBoundObject = (TimeBoundSAMLObject) xmlObject;
        if (!timeBoundObject.isValid()) {
            return false;
        }
    }

    XMLObject parent = xmlObject.getParent();
    if (parent != null) {
        return isValid(parent);
    }

    return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:SAML2Helper.java

示例3: lookupNamespaceURI

import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
 * Get the namespace URI bound to the specified prefix within the scope of the specified
 * XMLObject.
 *
 * @param xmlObject the XMLObject from which to search
 * @param prefix the prefix to search
 * @return the namespace URI bound to the prefix, or none if not found
 */
public static String lookupNamespaceURI(XMLObject xmlObject, String prefix) {
    XMLObject current = xmlObject;
    
    while (current != null) {
        for (Namespace ns : current.getNamespaces()) {
            if (DatatypeHelper.safeEquals(ns.getNamespacePrefix(), prefix)) {
                return ns.getNamespaceURI();
            }
        }
        current = current.getParent();
    }
    
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:XMLObjectHelper.java

示例4: lookupNamespacePrefix

import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
 * Get the prefix bound to the specified namespace URI within the scope of the specified
 * XMLObject.
 *
 * @param xmlObject the XMLObject from which to search
 * @param namespaceURI the namespace URI to search
 * @return the prefix bound to the namespace URI, or none if not found
 */
public static String lookupNamespacePrefix(XMLObject xmlObject, String namespaceURI) {
    XMLObject current = xmlObject;
    
    while (current != null) {
        for (Namespace ns : current.getNamespaces()) {
            if (DatatypeHelper.safeEquals(ns.getNamespaceURI(), namespaceURI)) {
                return ns.getNamespacePrefix();
            }
        }
        current = current.getParent();
    }
    
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:XMLObjectHelper.java


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