org.dom4j.io.OutputFormat.setIndentSize()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(201)

本文整理了Java中org.dom4j.io.OutputFormat.setIndentSize()方法的一些代码示例,展示了OutputFormat.setIndentSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OutputFormat.setIndentSize()方法的具体详情如下:
包路径:org.dom4j.io.OutputFormat
类名称:OutputFormat
方法名:setIndentSize

OutputFormat.setIndentSize介绍

[英]This will set the indent String's size; an indentSize of 4 would result in the indention being equivalent to the String "    " (four space characters).
[中]这将设置缩进String的大小;缩进大小为4将导致缩进与String”(四个空格字符)相等。

代码示例

代码示例来源:origin: webx/citrus

/** 输出DOM。 */
public static void writeDocument(Document doc, Writer writer, String charset) throws IOException {
  charset = defaultIfEmpty(trimToNull(charset), "UTF-8");
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setEncoding(charset);
  format.setIndent(true);
  format.setIndentSize(4);
  XMLWriter xmlWriter = new XMLWriter(writer, format);
  xmlWriter.write(doc);
  xmlWriter.flush();
}

代码示例来源:origin: webx/citrus

/** 输出DOM。 */
public static void writeDocument(Document doc, Writer writer, String charset) throws IOException {
  charset = defaultIfEmpty(trimToNull(charset), "UTF-8");
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setEncoding(charset);
  format.setIndent(true);
  format.setIndentSize(4);
  XMLWriter xmlWriter = new XMLWriter(writer, format);
  xmlWriter.write(doc);
  xmlWriter.flush();
}

代码示例来源:origin: webx/citrus

/** 输出DOM。 */
public static void writeDocument(Document doc, Writer writer, String charset) throws IOException {
  charset = defaultIfEmpty(trimToNull(charset), "UTF-8");
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setEncoding(charset);
  format.setIndent(true);
  format.setIndentSize(4);
  XMLWriter xmlWriter = new XMLWriter(writer, format);
  xmlWriter.write(doc);
  xmlWriter.flush();
}

代码示例来源:origin: org.dom4j/dom4j

setIndent(args[++i]);
} else if (args[i].equals("-indentSize")) {
  setIndentSize(Integer.parseInt(args[++i]));
} else if (args[i].startsWith("-expandEmpty")) {
  setExpandEmptyElements(true);

代码示例来源:origin: org.dom4j/dom4j

/**
 * A static helper method to create the default pretty printing format. This
 * format consists of an indent of 2 spaces, newlines after each element and
 * all other whitespace trimmed, and XMTML is false.
 * 
 * @return DOCUMENT ME!
 */
public static OutputFormat createPrettyPrint() {
  OutputFormat format = new OutputFormat();
  format.setIndentSize(2);
  format.setNewlines(true);
  format.setTrimText(true);
  format.setPadText(true);
  return format;
}

代码示例来源:origin: org.mule.modules/mule-module-xml

/**
 * @see OutputFormat#setIndentSize(int)
 */
public synchronized void setIndentSize(int indentSize)
{
  outputFormat.setIndentSize(indentSize);
}

代码示例来源:origin: org.apache.openmeetings/openmeetings-util

public static void toXml(Writer out, Document doc) throws Exception {
  OutputFormat outformat = OutputFormat.createPrettyPrint();
  outformat.setIndentSize(1);
  outformat.setIndent("\t");
  outformat.setEncoding(UTF_8.name());
  XMLWriter writer = new XMLWriter(out, outformat);
  writer.write(doc);
  writer.flush();
  out.flush();
  out.close();
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-io

public static OutputFormat createPrettyPrint() {
  OutputFormat format = new OutputFormat();
  format.setIndentSize(2);
  format.setNewlines(true);
  return format;
}

代码示例来源:origin: org.alfresco/alfresco-repository

private XMLWriter createXMLExporter(Writer writer)
{
  // Define output format
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding("UTF-8");
  // Construct an XML Exporter
  XMLWriter xmlWriter = new XMLWriter(writer, format);
  return xmlWriter;
}

代码示例来源:origin: org.alfresco/alfresco-repository

public XMLTransferRequsiteWriter(Writer out)
{
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding("UTF-8");
  this.writer = new XMLWriter(out, format);
}

代码示例来源:origin: Alfresco/alfresco-repository

public XMLTransferRequsiteWriter(Writer out)
{
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding("UTF-8");
  this.writer = new XMLWriter(out, format);
}

代码示例来源:origin: Alfresco/alfresco-repository

private XMLWriter createXMLExporter(Writer writer)
{
  // Define output format
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding("UTF-8");
  // Construct an XML Exporter
  XMLWriter xmlWriter = new XMLWriter(writer, format);
  return xmlWriter;
}

代码示例来源:origin: org.alfresco/alfresco-repository

public XMLWriter(OutputStream outputStream, boolean prettyPrint, String encoding)
    throws UnsupportedEncodingException
{
  OutputFormat format = prettyPrint ? OutputFormat.createPrettyPrint() : OutputFormat.createCompactFormat();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding(encoding);
  output = outputStream;
  this.dom4jWriter = new org.dom4j.io.XMLWriter(outputStream, format);
}

代码示例来源:origin: Alfresco/alfresco-repository

public XMLWriter(OutputStream outputStream, boolean prettyPrint, String encoding)
    throws UnsupportedEncodingException
{
  OutputFormat format = prettyPrint ? OutputFormat.createPrettyPrint() : OutputFormat.createCompactFormat();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding(encoding);
  output = outputStream;
  this.dom4jWriter = new org.dom4j.io.XMLWriter(outputStream, format);
}

代码示例来源:origin: com.alibaba.citrus/citrus-webx-all

/** 输出DOM。 */
public static void writeDocument(Document doc, Writer writer, String charset) throws IOException {
  charset = defaultIfEmpty(trimToNull(charset), "UTF-8");
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setEncoding(charset);
  format.setIndent(true);
  format.setIndentSize(4);
  XMLWriter xmlWriter = new XMLWriter(writer, format);
  xmlWriter.write(doc);
  xmlWriter.flush();
}

代码示例来源:origin: maven/dom4j

/**
 * A static helper method to create the default pretty printing format. This
 * format consists of an indent of 2 spaces, newlines after each element and
 * all other whitespace trimmed, and XMTML is false.
 * 
 * @return DOCUMENT ME!
 */
public static OutputFormat createPrettyPrint() {
  OutputFormat format = new OutputFormat();
  format.setIndentSize(2);
  format.setNewlines(true);
  format.setTrimText(true);
  format.setPadText(true);
  return format;
}

代码示例来源:origin: org.jenkins-ci.dom4j/dom4j

/**
 * A static helper method to create the default pretty printing format. This
 * format consists of an indent of 2 spaces, newlines after each element and
 * all other whitespace trimmed, and XMTML is false.
 * 
 * @return DOCUMENT ME!
 */
public static OutputFormat createPrettyPrint() {
  OutputFormat format = new OutputFormat();
  format.setIndentSize(2);
  format.setNewlines(true);
  format.setTrimText(true);
  format.setPadText(true);
  return format;
}

代码示例来源:origin: dom4j/dom4j

/**
 * A static helper method to create the default pretty printing format. This
 * format consists of an indent of 2 spaces, newlines after each element and
 * all other whitespace trimmed, and XMTML is false.
 * 
 * @return DOCUMENT ME!
 */
public static OutputFormat createPrettyPrint() {
  OutputFormat format = new OutputFormat();
  format.setIndentSize(2);
  format.setNewlines(true);
  format.setTrimText(true);
  format.setPadText(true);
  return format;
}

代码示例来源:origin: com.intoverflow.booster/booster-core

public static OutputFormat createPrettyPrint() {
  // OutputFormat format= OutputFormat.createPrettyPrint();
  OutputFormat format = new OutputFormat();
  format.setIndentSize(2);
  format.setIndent("\t");
  format.setNewlines(true);
  format.setTrimText(true);
  format.setPadText(true);
  format.setNewLineAfterDeclaration(false);
  return format;
}

代码示例来源:origin: com.intoverflow.base/intoverflow-util

public static OutputFormat createPrettyPrint() {
  // OutputFormat format= OutputFormat.createPrettyPrint();
  OutputFormat format = new OutputFormat();
  format.setIndentSize(2);
  format.setIndent("\t");
  format.setNewlines(true);
  format.setTrimText(true);
  format.setPadText(true);
  format.setNewLineAfterDeclaration(false);
  return format;
}

相关文章