当前位置: 首页>>代码示例>>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;未经允许,请勿转载。