本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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;
}