本文整理匯總了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();
}
示例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);
}
示例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);
}
示例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 );
}
示例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();
}