本文整理了Java中org.apache.xml.serialize.OutputFormat.setOmitDocumentType()
方法的一些代码示例,展示了OutputFormat.setOmitDocumentType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OutputFormat.setOmitDocumentType()
方法的具体详情如下:
包路径:org.apache.xml.serialize.OutputFormat
类名称:OutputFormat
方法名:setOmitDocumentType
[英]Sets DOCTYPE declaration omitting on and off.
[中]设置DOCTYPE声明忽略打开和关闭。
代码示例来源:origin: org.kuali.kfs/kfs-core
private byte[] addXMLNameSpace(Document xmlDoc,
String nameSpace){
Node node = xmlDoc.getDocumentElement();
Element element = (Element)node;
element.setAttribute("xmlns", nameSpace);
OutputFormat outputFormat = new OutputFormat(xmlDoc);
outputFormat.setOmitDocumentType(true);
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLSerializer serializer = new XMLSerializer( out,outputFormat );
try {
serializer.asDOMSerializer();
serializer.serialize( xmlDoc.getDocumentElement());
}
catch (IOException e) {
throw new RuntimeException(e);
}
return out.toByteArray();
}
}
代码示例来源:origin: org.kuali.kfs/kfs-core
outputFormat.setOmitDocumentType(true);
代码示例来源:origin: fcrepo3/fcrepo
@Deprecated
private static OutputFormat getOutputFormat(boolean omitXMLDeclaration,
boolean omitDocumentType) {
OutputFormat format = new OutputFormat(Method.XML, "UTF-8", true);
format.setIndent(2);
format.setLineWidth(80);
if (omitXMLDeclaration) {
format.setOmitXMLDeclaration(true);
}
if (omitDocumentType) {
format.setOmitDocumentType(true);
}
return format;
}
代码示例来源:origin: org.fcrepo/fcrepo-common
@Deprecated
private static OutputFormat getOutputFormat(boolean omitXMLDeclaration,
boolean omitDocumentType) {
OutputFormat format = new OutputFormat(Method.XML, "UTF-8", true);
format.setIndent(2);
format.setLineWidth(80);
if (omitXMLDeclaration) {
format.setOmitXMLDeclaration(true);
}
if (omitDocumentType) {
format.setOmitDocumentType(true);
}
return format;
}
代码示例来源: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.wso2.bpel/ode-utils
public static ContentHandler getXercesSerializer(OutputStream os) {
XMLSerializer serializer = new XMLSerializer();
OutputFormat format = new OutputFormat();
format.setPreserveSpace(true);
format.setOmitDocumentType(true);
serializer.setOutputFormat(format);
serializer.setOutputByteStream(os);
return serializer;
}
}
代码示例来源: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 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 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: 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: 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: org.owasp/antisamy
format.setOmitDocumentType( "true".equals(policy.getDirective(Policy.OMIT_DOCTYPE_DECLARATION)) );
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!