List of usage examples for org.dom4j.io OutputFormat setNewLineAfterNTags
public void setNewLineAfterNTags(int tagCount)
From source file:au.com.acegi.xmlformat.XmlFormatPlugin.java
License:Apache License
private OutputFormat buildFormatter() { final OutputFormat fmt = createPrettyPrint(); fmt.setAttributeQuoteCharacter(attributeQuoteChar); fmt.setEncoding(encoding);// www . j av a 2 s . c o m fmt.setExpandEmptyElements(expandEmptyElements); fmt.setIndentSize(indentSize); fmt.setLineSeparator(determineLineSeparator()); fmt.setNewLineAfterDeclaration(newLineAfterDeclaration); fmt.setNewLineAfterNTags(newLineAfterNTags); fmt.setNewlines(newlines); fmt.setOmitEncoding(omitEncoding); fmt.setPadText(padText); fmt.setSuppressDeclaration(suppressDeclaration); fmt.setTrimText(trimText); fmt.setXHTML(xhtml); return fmt; }
From source file:eu.planets_project.pp.plato.action.workflow.ValidatePlanAction.java
License:Open Source License
/** * reads the executable preservation plan and formats it. * //from www. j a v a2 s .co m */ private String formatExecutablePlan(String executablePlan) { if (executablePlan == null || "".equals(executablePlan)) { return ""; } try { Document doc = DocumentHelper.parseText(executablePlan); StringWriter sw = new StringWriter(); OutputFormat format = OutputFormat.createPrettyPrint(); format.setNewlines(true); format.setTrimText(true); format.setIndent(" "); format.setExpandEmptyElements(false); format.setNewLineAfterNTags(20); XMLWriter writer = new XMLWriter(sw, format); writer.write(doc); writer.close(); return sw.toString(); } catch (DocumentException e) { return ""; } catch (IOException e) { return ""; } }