本文整理匯總了Java中org.jdom.Document.setDocType方法的典型用法代碼示例。如果您正苦於以下問題:Java Document.setDocType方法的具體用法?Java Document.setDocType怎麽用?Java Document.setDocType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdom.Document
的用法示例。
在下文中一共展示了Document.setDocType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例2: createDocument
import org.jdom.Document; //導入方法依賴的package包/類
protected Document createDocument(Element root) {
Document doc = new Document(root);
DocType docType = new DocType(RSS091NetscapeParser.ELEMENT_NAME,
RSS091NetscapeParser.PUBLIC_ID,
RSS091NetscapeParser.SYSTEM_ID);
doc.setDocType(docType);
return doc;
}