本文整理了Java中com.sun.org.apache.xml.internal.serialize.OutputFormat.setOmitXMLDeclaration()
方法的一些代码示例,展示了OutputFormat.setOmitXMLDeclaration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OutputFormat.setOmitXMLDeclaration()
方法的具体详情如下:
包路径:com.sun.org.apache.xml.internal.serialize.OutputFormat
类名称:OutputFormat
方法名:setOmitXMLDeclaration
[英]Sets XML declaration omitting on and off.
[中]设置XML声明忽略打开和关闭。
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
ser.fNamespacePrefixes = (features & NSDECL) != 0;
ser._format.setOmitComments((features & COMMENTS)==0);
ser._format.setOmitXMLDeclaration((features & XMLDECL) == 0);
ser._format.setIndenting((features & FORMAT_PRETTY_PRINT) != 0);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
ser.fNamespacePrefixes = (features & NSDECL) != 0;
ser._format.setOmitComments((features & COMMENTS)==0);
ser._format.setOmitXMLDeclaration((features & XMLDECL) == 0);
ser._format.setIndenting((features & FORMAT_PRETTY_PRINT) != 0);
代码示例来源: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: 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 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: 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: 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: 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: 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: fcrepo3/fcrepo
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: com.marklogic/marklogic-data-movement-components
@Override
public String generateOutput(DocumentRecord documentRecord) {
if (Format.XML.equals(documentRecord.getFormat())) {
DOMHandle handle = documentRecord.getContent(new DOMHandle());
Document document = handle.get();
OutputFormat format = new OutputFormat(handle.get());
format.setOmitXMLDeclaration(omitXmlDeclaration);
StringWriter writer = new StringWriter();
try {
new XMLSerializer(writer, format).serialize(document);
return writer.toString();
} catch (IOException e) {
throw new RuntimeException("Unable to serialize XML document to string: " + e.getMessage(), e);
}
} else if (logger.isDebugEnabled()) {
logger.debug(String.format("Document '%s' has a format of '%s', so will not attempt to remove the XML declaration from it",
documentRecord.getUri(), documentRecord.getFormat().name()));
}
return documentRecord.getContent(new StringHandle()).get();
}
内容来源于网络,如有侵权,请联系作者删除!