org.apache.xml.serialize.OutputFormat.setOmitXMLDeclaration()方法的使用及代码示例

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

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

OutputFormat.setOmitXMLDeclaration介绍

[英]Sets XML declaration omitting on and off.
[中]设置XML声明忽略打开和关闭。

代码示例

代码示例来源:origin: stackoverflow.com

OutputFormat format = new OutputFormat(document);
format.setIndenting(true);
format.setOmitXMLDeclaration(true);

代码示例来源:origin: pentaho/mondrian

serial.serialize((Document) node);
} else if (node instanceof Element) {
  format.setOmitXMLDeclaration(true);
  serial.serialize((Element) node);
} else if (node instanceof DocumentFragment) {
  format.setOmitXMLDeclaration(true);
  serial.serialize((DocumentFragment) node);
} else if (node instanceof Text) {

代码示例来源:origin: org.geotools.xsd/gt-core

/**
 * Sets XML declaration omitting on and off.
 * 
 * @param ommitXmlDeclaration
 *            <code>true</code> if XML declaration should be omitted
 */
public void setOmitXMLDeclaration(final boolean ommitXmlDeclaration) {
  outputFormat.setOmitXMLDeclaration(ommitXmlDeclaration);
}

代码示例来源:origin: org.geotools/gt2-xml-xsd

/**
 * Sets XML declaration omitting on and off.
 * 
 * @param ommitXmlDeclaration
 *            <code>true</code> if XML declaration should be omitted
 */
public void setOmitXMLDeclaration(final boolean ommitXmlDeclaration) {
  outputFormat.setOmitXMLDeclaration(ommitXmlDeclaration);
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-forms-layout-core

@XContent("description")
public void setDescription(DocumentFragment descriptionDOM) {
  try {
    OutputFormat of = new OutputFormat();
    of.setOmitXMLDeclaration(true);
    this.description = DOMSerializer.toString(descriptionDOM, of).trim();
  } catch (IOException e) {
    log.error(e, e);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static String toStringOmitXml(Element element) throws IOException {
  OutputFormat of = new OutputFormat();
  of.setOmitXMLDeclaration(true);
  return toString(element, of);
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-forms-layout-core

@XContent("description")
public void setDescription(DocumentFragment descriptionDOM) {
  try {
    OutputFormat of = new OutputFormat();
    of.setOmitXMLDeclaration(true);
    this.description = DOMSerializer.toString(descriptionDOM, of).trim();
  } catch (IOException e) {
    log.error(e, e);
  }
}

代码示例来源:origin: com.ibm.sbt/com.ibm.commons.xml

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);
}

代码示例来源:origin: org.fcrepo/fcrepo-common

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;
}

代码示例来源:origin: fcrepo3/fcrepo

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;
}

代码示例来源:origin: fcrepo3/fcrepo

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;
  }
}

代码示例来源:origin: org.fcrepo/fcrepo-common

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;
  }
}

代码示例来源:origin: fcrepo3/fcrepo

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;
}

代码示例来源:origin: fcrepo3/fcrepo

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;
}

代码示例来源:origin: org.fcrepo/fcrepo-common

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;
}

代码示例来源:origin: org.fcrepo/fcrepo-common

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;
}

代码示例来源:origin: fcrepo3/fcrepo

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;
}

代码示例来源:origin: org.fcrepo/fcrepo-common

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;
}

代码示例来源:origin: org.fcrepo/fcrepo-common

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;
}

代码示例来源:origin: org.jasig.portal/uportal3-impl

public SerializingUserLayoutDao() {
  layoutOutputFormat=new OutputFormat();
  layoutOutputFormat.setIndenting(true);
  layoutOutputFormat.setLineWidth(0);
  layoutOutputFormat.setOmitDocumentType(false);
  layoutOutputFormat.setPreserveSpace(true);
  layoutOutputFormat.setEncoding("UTF-8");
  layoutOutputFormat.setOmitComments(false);
  layoutOutputFormat.setOmitXMLDeclaration(false);
  layoutOutputFormat.setDoctype(publicDoctype, systemDoctype);
}

相关文章