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


Java Format.getRawFormat方法代碼示例

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


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

示例1: export

import org.jdom.output.Format; //導入方法依賴的package包/類
public byte[] export(ExportDataSet dataSet) {
    if (dataSet == null) {
        throw new IllegalArgumentException("Xml Exporter cannot handle NULL data.");
    }
    Element rootElement = new Element(DATA_ELEMENT, WORKFLOW_NAMESPACE);
    rootElement.addNamespaceDeclaration(SCHEMA_NAMESPACE);
    rootElement.setAttribute(SCHEMA_LOCATION_ATTR, WORKFLOW_SCHEMA_LOCATION, SCHEMA_NAMESPACE);
    Document document = new Document(rootElement);
    boolean shouldPrettyPrint = true;
    for (XmlExporter exporter : xmlImpexRegistry.getExporters()) {
    	Element exportedElement = exporter.export(dataSet);
    	if (exportedElement != null) {
    		if (!exporter.supportPrettyPrint()) {
    			shouldPrettyPrint = false;
    		}
    		appendIfNotEmpty(rootElement, exportedElement);
    	}
    }

    // TODO: KULRICE-4420 - this needs cleanup
    Format f;
    if (!shouldPrettyPrint) {
        f = Format.getRawFormat();
        f.setExpandEmptyElements(false);
        f.setTextMode(Format.TextMode.PRESERVE);
    } else {
        f = Format.getPrettyFormat();
    }
    XMLOutputter outputer = new XMLOutputter(f);
    StringWriter writer = new StringWriter();
    try {
        outputer.output(document, writer);
    } catch (IOException e) {
        throw new WorkflowRuntimeException("Could not write XML data export.", e);
    }
    return writer.toString().getBytes();
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:38,代碼來源:XmlExporterServiceImpl.java

示例2: write

import org.jdom.output.Format; //導入方法依賴的package包/類
/**
 * Write out the (possibly modified) GAPP file to its new location.
 * 
 * @throws IOException if an I/O error occurs.
 */
public void write() throws IOException {
  finish();
  File newGappFile = Files.fileFromURL(gappFileURL);
  FileOutputStream fos = new FileOutputStream(newGappFile);
  BufferedOutputStream out = new BufferedOutputStream(fos);

  XMLOutputter outputter = new XMLOutputter(Format.getRawFormat());
  outputter.output(gappDocument, out);
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:15,代碼來源:GappModel.java

示例3: JPFClasspathFixProcessor

import org.jdom.output.Format; //導入方法依賴的package包/類
public JPFClasspathFixProcessor()
{
	super();
	sax = new SAXBuilder();
	sax.setValidation(false);
	sax.setReuseParser(true);
	sax.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
	Format format = Format.getRawFormat();
	format.setOmitEncoding(true);
	format.setOmitDeclaration(true);
	format.setLineSeparator("\n");
	format.setEncoding("UTF-8");

	xmlOut = new XMLOutputter(format);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:16,代碼來源:JPFClasspathFixProcessor.java

示例4: write

import org.jdom.output.Format; //導入方法依賴的package包/類
/**
 * Method write
 *
 * @param project
 * @param writer
 * @param document
 */
public void write( Model project, Document document, OutputStreamWriter writer )
    throws java.io.IOException
{
    Format format = Format.getRawFormat();
    format.setEncoding( writer.getEncoding() ).setLineSeparator( System.getProperty( "line.separator" ) );
    write( project, document, writer, format );
}
 
開發者ID:javiersigler,項目名稱:apache-maven-shade-plugin,代碼行數:15,代碼來源:MavenJDOMWriter.java

示例5: getJdomFormat

import org.jdom.output.Format; //導入方法依賴的package包/類
/**
 * Internal function to choose a format based on a boolean flag.
 *
 * @param indent whether to use indented or raw format
 * @return The format
 */
private static Format getJdomFormat(boolean indent) {
    return indent ? Format.getPrettyFormat() : Format.getRawFormat();
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:10,代碼來源:XmlJotter.java


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