當前位置: 首頁>>代碼示例>>Java>>正文


Java Document.setRootElement方法代碼示例

本文整理匯總了Java中org.jdom.Document.setRootElement方法的典型用法代碼示例。如果您正苦於以下問題:Java Document.setRootElement方法的具體用法?Java Document.setRootElement怎麽用?Java Document.setRootElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jdom.Document的用法示例。


在下文中一共展示了Document.setRootElement方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writePluginJpf

import org.jdom.Document; //導入方法依賴的package包/類
@SuppressWarnings("nls")
private void writePluginJpf(IProgressMonitor monitor, IProject project) throws CoreException
{
	Document doc = new Document();
	doc.setDocType(new DocType("plugin", "-//JPF//Java Plug-in Manifest 1.0",
		"http://jpf.sourceforge.net/plugin_1_0.dtd"));
	Element rootElem = new Element("plugin");
	doc.setRootElement(rootElem);
	rootElem.setAttribute("id", project.getName());
	rootElem.setAttribute("version", "1");
	Element requires = new Element("requires");
	rootElem.addContent(requires);
	Element runtime = new Element("runtime");
	Element srcLib = new Element("library");
	srcLib.setAttribute("type", "code");
	srcLib.setAttribute("path", "classes/");
	srcLib.setAttribute("id", "classes");
	Element export = new Element("export");
	export.setAttribute("prefix", "*");
	srcLib.addContent(export);
	runtime.addContent(srcLib);
	rootElem.addContent(runtime);
	fFirstPage.customizeManifest(rootElem, project, monitor);
	if( requires.getContentSize() == 0 )
	{
		rootElem.removeContent(requires);
	}

	IFile manifest = JPFProject.getManifest(project);
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	try
	{
		xmlOut.output(doc, baos);
	}
	catch( IOException e )
	{
		throw new RuntimeException(e);
	}
	manifest.create(new ByteArrayInputStream(baos.toByteArray()), true, monitor);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:41,代碼來源:NewPluginWizard.java

示例2: save

import org.jdom.Document; //導入方法依賴的package包/類
public void save(File sav) {
	Document document = new Document();
	Element root = new Element("blocks");
	document.setRootElement(root);
	for (int x = 0; x < BLOCKS_WIDTH; x++) {
		for (int y = 0; y < BLOCKS_HEIGHT; y++) {
			Element block = new Element("block");
			block.setAttribute("x", String.valueOf((int) (blocks[x][y].getX() / BLOCK_SIZE)));
			block.setAttribute("y", String.valueOf((int) (blocks[x][y].getY() / BLOCK_SIZE)));
			block.setAttribute("type", String.valueOf(blocks[x][y].getType()));
			root.addContent(block);
		}
	}
	XMLOutputter output = new XMLOutputter();
	try {
		output.output(document, new FileOutputStream(sav));
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:nitrodragon,項目名稱:lwjgl_collection,代碼行數:21,代碼來源:BlockGrid.java

示例3: signSamlResponse

import org.jdom.Document; //導入方法依賴的package包/類
/**
 * Sign SAML response.
 *
 * @param samlResponse the SAML response
 * @param privateKey the private key
 * @param publicKey the public key
 * @return the response
 */
public final String signSamlResponse(final String samlResponse,
                                     final PrivateKey privateKey, final PublicKey publicKey) {
    final Document doc = constructDocumentFromXml(samlResponse);

    if (doc != null) {
        final org.jdom.Element signedElement = signSamlElement(doc.getRootElement(),
                privateKey, publicKey);
        doc.setRootElement((org.jdom.Element) signedElement.detach());
        return new XMLOutputter().outputString(doc);
    }
    throw new RuntimeException("Error signing SAML Response: Null document");
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:21,代碼來源:AbstractSamlObjectBuilder.java

示例4: signSamlResponse

import org.jdom.Document; //導入方法依賴的package包/類
/**
 * Sign SAML response.
 *
 * @param samlResponse the SAML response
 * @param privateKey   the private key
 * @param publicKey    the public key
 * @return the response
 */
public static String signSamlResponse(final String samlResponse, final PrivateKey privateKey, final PublicKey publicKey) {
    final Document doc = constructDocumentFromXml(samlResponse);

    if (doc != null) {
        final org.jdom.Element signedElement = signSamlElement(doc.getRootElement(),
                privateKey, publicKey);
        doc.setRootElement((org.jdom.Element) signedElement.detach());
        return new XMLOutputter().outputString(doc);
    }
    throw new RuntimeException("Error signing SAML Response: Null document");
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:20,代碼來源:AbstractSamlObjectBuilder.java

示例5: signSamlResponse

import org.jdom.Document; //導入方法依賴的package包/類
public static String signSamlResponse(final String samlResponse,
        final PrivateKey privateKey, final PublicKey publicKey) {
    final Document doc = constructDocumentFromXmlString(samlResponse);

    if (doc != null) {
        final Element signedElement = signSamlElement(doc.getRootElement(),
                privateKey, publicKey);
        doc.setRootElement((Element) signedElement.detach());
        return new XMLOutputter().outputString(doc);
    }
    throw new RuntimeException("Error signing SAML Response: Null document");
}
 
開發者ID:luotuo,項目名稱:cas4.0.x-server-wechat,代碼行數:13,代碼來源:SamlUtils.java


注:本文中的org.jdom.Document.setRootElement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。