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

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

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

OutputFormat.setNewLineAfterDeclaration介绍

[英]This will set whether a new line is printed after the XML declaration (assuming it is not supressed.)
[中]这将设置是否在XML声明之后打印新行(假设它未被禁止)

代码示例

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

/**
 * @see OutputFormat#setNewLineAfterDeclaration(boolean)
 */
public synchronized void setNewLineAfterDeclaration(boolean newline)
{
  outputFormat.setNewLineAfterDeclaration(newline);
}

代码示例来源: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: 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: 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: org.alfresco/alfresco-repository

/**
 * Get the writer for the import file
 * 
 * @param destination    the destination XML import file
 * @return                the XML writer
 */
private XMLWriter getWriter(String destination)
{
  try
  {
     // Define output format
    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setNewLineAfterDeclaration(false);
    format.setIndentSize(INDENT_SIZE);
    format.setEncoding(this.fileEncoding);

    return new XMLWriter(new FileOutputStream(destination), format);
  }
  catch (Exception exception)
  {
    throw new AlfrescoRuntimeException("Unable to create XML writer.", exception);
  }
}

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

/**
 * Get the writer for the import file
 * 
 * @param destination    the destination XML import file
 * @return                the XML writer
 */
private XMLWriter getWriter(String destination)
{
  try
  {
     // Define output format
    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setNewLineAfterDeclaration(false);
    format.setIndentSize(INDENT_SIZE);
    format.setEncoding(this.fileEncoding);

    return new XMLWriter(new FileOutputStream(destination), format);
  }
  catch (Exception exception)
  {
    throw new AlfrescoRuntimeException("Unable to create XML writer.", exception);
  }
}

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

/**
 * Start the transfer report
 */
public void startTransferReport(String encoding, Writer writer) throws SAXException
{
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding(encoding);
  
  this.writer = new XMLWriter(writer, format);
  this.writer.startDocument();
  
  this.writer.startPrefixMapping(PREFIX, TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI);

  // Start Transfer Manifest  // uri, name, prefix
  this.writer.startElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, TransferReportModel.LOCALNAME_TRANSFER_REPORT,  PREFIX + ":" + TransferReportModel.LOCALNAME_TRANSFER_REPORT, EMPTY_ATTRIBUTES);
}

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

/**
 * Start the transfer report
 */
public void startTransferReport(String encoding, Writer writer)
{
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding(encoding);
  
  try 
  {
  
  this.writer = new XMLWriter(writer, format);
  this.writer.startDocument();
  
  this.writer.startPrefixMapping(PREFIX, TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI);

  // Start Transfer Manifest  // uri, name, prefix
  this.writer.startElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_DEST_REPORT,  PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_DEST_REPORT, EMPTY_ATTRIBUTES);
  
  } 
  catch (SAXException se)
  {
    se.printStackTrace();
  }
}

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

/**
 * Start the transfer report
 */
public void startTransferReport(String encoding, Writer writer)
{
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding(encoding);
  
  try 
  {
  
  this.writer = new XMLWriter(writer, format);
  this.writer.startDocument();
  
  this.writer.startPrefixMapping(PREFIX, TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI);

  // Start Transfer Manifest  // uri, name, prefix
  this.writer.startElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_DEST_REPORT,  PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_DEST_REPORT, EMPTY_ATTRIBUTES);
  
  } 
  catch (SAXException se)
  {
    se.printStackTrace();
  }
}

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

/**
 * Start the transfer report
 */
public void startTransferReport(String encoding, Writer writer) throws SAXException
{
  OutputFormat format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding(encoding);
  
  this.writer = new XMLWriter(writer, format);
  this.writer.startDocument();
  
  this.writer.startPrefixMapping(PREFIX, TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI);

  // Start Transfer Manifest  // uri, name, prefix
  this.writer.startElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, TransferReportModel.LOCALNAME_TRANSFER_REPORT,  PREFIX + ":" + TransferReportModel.LOCALNAME_TRANSFER_REPORT, EMPTY_ATTRIBUTES);
}

代码示例来源: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;
}

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

/**
 * Start the transfer manifest
 */
public void startTransferManifest(Writer writer) throws SAXException
{
  format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding("UTF-8");
  this.writer = new XMLWriter(writer, format);
  this.writer.startDocument();
  this.writer.startPrefixMapping(PREFIX, TransferModel.TRANSFER_MODEL_1_0_URI);
  this.writer.startPrefixMapping("cm", NamespaceService.CONTENT_MODEL_1_0_URI);
  // Start Transfer Manifest // uri, name, prefix
  this.writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
        ManifestModel.LOCALNAME_TRANSFER_MAINIFEST, PREFIX + ":"
              + ManifestModel.LOCALNAME_TRANSFER_MAINIFEST, EMPTY_ATTRIBUTES);
}

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

/**
 * Start the transfer manifest
 */
public void startTransferManifest(Writer writer) throws SAXException
{
  format = OutputFormat.createPrettyPrint();
  format.setNewLineAfterDeclaration(false);
  format.setIndentSize(3);
  format.setEncoding("UTF-8");
  this.writer = new XMLWriter(writer, format);
  this.writer.startDocument();
  this.writer.startPrefixMapping(PREFIX, TransferModel.TRANSFER_MODEL_1_0_URI);
  this.writer.startPrefixMapping("cm", NamespaceService.CONTENT_MODEL_1_0_URI);
  // Start Transfer Manifest // uri, name, prefix
  this.writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
        ManifestModel.LOCALNAME_TRANSFER_MAINIFEST, PREFIX + ":"
              + ManifestModel.LOCALNAME_TRANSFER_MAINIFEST, EMPTY_ATTRIBUTES);
}

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

format.setNewLineAfterDeclaration(false);
format.setIndentSize(indentSize);
format.setEncoding("UTF-8");

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

format.setNewLineAfterDeclaration(false);
format.setIndentSize(indentSize);
format.setEncoding("UTF-8");

相关文章