private OutputFormat createOutputFormat() { OutputFormat format = new OutputFormat(); format.setIndenting(true); format.setIndent(5); return format; }
/** * Set the format line indent value. * @param indent line indent value */ public void setIndent(int indent) { format.setIndent(indent); }
private static OutputFormat getPrettyPrint() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setEncoding("UTF-8"); fmt.setIndenting(true); fmt.setIndent(2); fmt.setOmitXMLDeclaration(true); return fmt; }
private static OutputFormat getXmlNoSpace(String encoding) { OutputFormat fmt = new OutputFormat("XML", encoding, false); // indent == 0 means add no indenting fmt.setIndent(0); // default line width is 72, but only applies when indenting fmt.setLineWidth(0); fmt.setPreserveSpace(false); return fmt; }
private static OutputFormat getPrettyPrint() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setEncoding("UTF-8"); fmt.setIndenting(true); fmt.setIndent(2); fmt.setOmitXMLDeclaration(true); return fmt; }
private static OutputFormat getXmlNoSpace(String encoding) { OutputFormat fmt = new OutputFormat("XML", encoding, false); // indent == 0 means add no indenting fmt.setIndent(0); // default line width is 72, but only applies when indenting fmt.setLineWidth(0); fmt.setPreserveSpace(false); return fmt; }
private static OutputFormat getPrettyPrintWithDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setEncoding("UTF-8"); fmt.setIndenting(true); fmt.setIndent(2); fmt.setOmitXMLDeclaration(false); return fmt; } }
private XMLSerializer createXMLSerializer(Node node, Format fmt) { if(fmt==null) { fmt = Format.defaultFormat; } OutputFormat format = new OutputFormat(); //node.getOwnerDocument()); format.setIndent(fmt.indent); format.setOmitXMLDeclaration(!fmt.xmlDecl); format.setEncoding(fmt.encoding); return new XMLSerializer(format); }
private static OutputFormat getPrettyPrintWithDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setEncoding("UTF-8"); fmt.setIndenting(true); fmt.setIndent(2); fmt.setOmitXMLDeclaration(false); return fmt; } }
/** Get the output format to be used when serializing this buffer */ public OutputFormat getOutputFormat() { String xencoding = getIanaEncoding(getEncoding()); OutputFormat format = new OutputFormat(sourceDocument, xencoding, true); // do-indent==true format.setLineWidth(160); format.setIndent(4); format.setAllowJavaNames(true); return format; }
public static String format(String unformattedXml) throws IOException, ParserConfigurationException, SAXException { final Document document = parseXmlFile(unformattedXml); OutputFormat format = new OutputFormat(document); format.setLineWidth(LINE_WIDTH); format.setIndenting(true); format.setIndent(INDENT); Writer out = new StringWriter(); XMLSerializer serializer = new XMLSerializer(out, format); serializer.serialize(document); return out.toString(); }
private static OutputFormat getMgmtWithDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(120); fmt.setPreserveSpace(false); fmt.setOmitXMLDeclaration(false); fmt.setOmitDocumentType(true); return fmt; }
public static String format(String unformattedXml) throws IOException, ParserConfigurationException, SAXException { final Document document = parseXmlFile(unformattedXml); OutputFormat format = new OutputFormat(document); format.setLineWidth(LINE_WIDTH); format.setIndenting(true); format.setIndent(INDENT); Writer out = new StringWriter(); XMLSerializer serializer = new XMLSerializer(out, format); serializer.serialize(document); return out.toString(); }
private static OutputFormat getConsoleWithDocType() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(80); fmt.setPreserveSpace(false); // default is false fmt.setOmitXMLDeclaration(false); // default is false fmt.setOmitDocumentType(false); return fmt; }
private static OutputFormat getConsoleWithDocType() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(80); fmt.setPreserveSpace(false); // default is false fmt.setOmitXMLDeclaration(false); // default is false fmt.setOmitDocumentType(false); return fmt; }
private static OutputFormat getMgmtNoDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(120); fmt.setPreserveSpace(false); fmt.setOmitXMLDeclaration(true); fmt.setOmitDocumentType(true); return fmt; }
private static OutputFormat getConsoleNoDocType() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(80); fmt.setPreserveSpace(false); // default is false fmt.setOmitXMLDeclaration(false); fmt.setOmitDocumentType(true); return fmt; }
private static OutputFormat getMgmtNoDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(120); fmt.setPreserveSpace(false); fmt.setOmitXMLDeclaration(true); fmt.setOmitDocumentType(true); return fmt; }
private static OutputFormat getMgmtWithDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(120); fmt.setPreserveSpace(false); fmt.setOmitXMLDeclaration(false); fmt.setOmitDocumentType(true); return fmt; }
private static OutputFormat getConsoleNoDocType() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(80); fmt.setPreserveSpace(false); // default is false fmt.setOmitXMLDeclaration(false); fmt.setOmitDocumentType(true); return fmt; }