本文整理汇总了Java中com.sun.org.apache.xml.internal.security.utils.XMLUtils.addReturnBeforeChild方法的典型用法代码示例。如果您正苦于以下问题:Java XMLUtils.addReturnBeforeChild方法的具体用法?Java XMLUtils.addReturnBeforeChild怎么用?Java XMLUtils.addReturnBeforeChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xml.internal.security.utils.XMLUtils
的用法示例。
在下文中一共展示了XMLUtils.addReturnBeforeChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getKeyInfo
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Returns the KeyInfo child. If we are in signing mode and the KeyInfo
* does not exist yet, it is created on demand and added to the Signature.
* <br>
* This allows to add arbitrary content to the KeyInfo during signing.
*
* @return the KeyInfo object
*/
public KeyInfo getKeyInfo() {
// check to see if we are signing and if we have to create a keyinfo
if (this.state == MODE_SIGN && this.keyInfo == null) {
// create the KeyInfo
this.keyInfo = new KeyInfo(this.doc);
// get the Element from KeyInfo
Element keyInfoElement = this.keyInfo.getElement();
Element firstObject =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_OBJECT, 0
);
if (firstObject != null) {
// add it before the object
this.constructionElement.insertBefore(keyInfoElement, firstObject);
XMLUtils.addReturnBeforeChild(this.constructionElement, firstObject);
} else {
// add it as the last element to the signature
this.constructionElement.appendChild(keyInfoElement);
XMLUtils.addReturnToElement(this.constructionElement);
}
}
return this.keyInfo;
}