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

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

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

OutputFormat.setOmitComments介绍

[英]Sets comment omitting on and off.
[中]设置注释省略的开和关。

代码示例

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

OutputStream outputStream = new FileOutputStream(new File(xMLFilePath));
 OutputFormat outputFormat = new OutputFormat(doc, "UTF-8", true);
 outputFormat.setOmitComments(true);
 outputFormat.setLineWidth(0);
 XMLSerializer serializer = new XMLSerializer(outputStream, outputFormat);
 serializer.serialize(doc);
 outputStream.close();

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

ser.fNamespacePrefixes = (features & NSDECL) != 0;
ser._format.setIndenting((features & PRETTY_PRINT) != 0);
ser._format.setOmitComments((features & COMMENTS)==0);
ser._format.setOmitXMLDeclaration((features & XMLDECL) == 0);

代码示例来源:origin: org.opengis.cite/cite1-utils

public static void writeXml(Element element, OutputStream os)
 throws IOException
{
 OutputFormat format = new OutputFormat("XML", "UTF-8", false);
 format.setOmitComments(false);
 format.setLineWidth(0);
 XMLSerializer serializer = new XMLSerializer(format);
 serializer.setOutputByteStream(os);
 serializer.serialize(element);
}

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

代码示例来源:origin: org.opengis.cite/cite1-utils

public static void writeXml(Element element, Writer out, int indent)
 throws IOException
{
 OutputFormat format = new OutputFormat("XML", "UTF-8", false);
 format.setOmitComments(false);
 if (indent > 0) {
  format.setIndenting(true);
  format.setIndent(indent);
 }
 format.setLineWidth(0);
 XMLSerializer serializer = new XMLSerializer(format);
 serializer.setOutputCharStream(out);
 serializer.serialize(element);
}

代码示例来源:origin: org.opengis.cite/cite1-utils

public static void writeXml(Document document, Writer out, int indent)
 throws IOException
{
 OutputFormat format = new OutputFormat("XML", "UTF-8", false);
 format.setOmitComments(false);
 if (indent > 0) {
  format.setIndenting(true);
  format.setIndent(indent);
 }
 format.setLineWidth(0);
 XMLSerializer serializer = new XMLSerializer(format);
 serializer.setOutputCharStream(out);
 serializer.serialize(document);
}

相关文章