本文整理了Java中com.sun.org.apache.xml.internal.serialize.OutputFormat.setEncoding()
方法的一些代码示例,展示了OutputFormat.setEncoding()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OutputFormat.setEncoding()
方法的具体详情如下:
包路径:com.sun.org.apache.xml.internal.serialize.OutputFormat
类名称:OutputFormat
方法名:setEncoding
[英]Sets the encoding for this output method with an EncodingInfo
instance.
[中]使用EncodingInfo
实例设置此输出方法的编码。
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* Constructs a new output format with the proper method,
* document type identifiers and media type for the specified
* document, and with the specified encoding. If <tt>indent</tt>
* is true, the document will be pretty printed with the default
* indentation level and default line wrapping.
*
* @param doc The document to output
* @param encoding The specified encoding
* @param indenting True for pretty printing
* @see #setEncoding
* @see #setIndenting
* @see #whichMethod
*/
public OutputFormat( Document doc, String encoding, boolean indenting )
{
this( doc );
setEncoding( encoding );
setIndenting( indenting );
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* Constructs a new output format with the proper method,
* document type identifiers and media type for the specified
* document, and with the specified encoding. If <tt>indent</tt>
* is true, the document will be pretty printed with the default
* indentation level and default line wrapping.
*
* @param doc The document to output
* @param encoding The specified encoding
* @param indenting True for pretty printing
* @see #setEncoding
* @see #setIndenting
* @see #whichMethod
*/
public OutputFormat( Document doc, String encoding, boolean indenting )
{
this( doc );
setEncoding( encoding );
setIndenting( indenting );
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* Constructs a new output format with the default values for
* the specified method and encoding. If <tt>indent</tt>
* is true, the document will be pretty printed with the default
* indentation level and default line wrapping.
*
* @param method The specified output method
* @param encoding The specified encoding
* @param indenting True for pretty printing
* @see #setEncoding
* @see #setIndenting
* @see #setMethod
*/
public OutputFormat( String method, String encoding, boolean indenting )
{
setMethod( method );
setEncoding( encoding );
setIndenting( indenting );
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* Constructs a new output format with the default values for
* the specified method and encoding. If <tt>indent</tt>
* is true, the document will be pretty printed with the default
* indentation level and default line wrapping.
*
* @param method The specified output method
* @param encoding The specified encoding
* @param indenting True for pretty printing
* @see #setEncoding
* @see #setIndenting
* @see #setMethod
*/
public OutputFormat( String method, String encoding, boolean indenting )
{
setMethod( method );
setEncoding( encoding );
setIndenting( indenting );
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
private void copySettings(XMLSerializer src, XMLSerializer dest) {
dest.fDOMErrorHandler = fErrorHandler;
dest._format.setEncoding(src._format.getEncoding());
dest._format.setLineSeparator(src._format.getLineSeparator());
dest.fDOMFilter = src.fDOMFilter;
}//copysettings
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
private void copySettings(XMLSerializer src, XMLSerializer dest) {
dest.fDOMErrorHandler = fErrorHandler;
dest._format.setEncoding(src._format.getEncoding());
dest._format.setLineSeparator(src._format.getLineSeparator());
dest.fDOMFilter = src.fDOMFilter;
}//copysettings
代码示例来源: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: 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: SAMLRaider/SAMLRaider
public String getString(Document document, boolean indenting, int indent) throws IOException{
OutputFormat format = new OutputFormat(document);
format.setLineWidth(200);
format.setIndenting(indenting);
format.setIndent(indent);
format.setPreserveEmptyAttributes(true);
format.setEncoding("UTF-8");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLSerializer serializer = new XMLSerializer(baos, format);
serializer.asDOMSerializer();
serializer.serialize(document);
return baos.toString("UTF-8");
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
ser._format.setEncoding(encoding);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
ser._format.setEncoding(encoding);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
try {
prepareForSerialization(ser, wnode);
ser._format.setEncoding("UTF-16");
ser.setOutputCharStream(destination);
if (wnode.getNodeType() == Node.DOCUMENT_NODE) {
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
try {
prepareForSerialization(ser, wnode);
ser._format.setEncoding("UTF-16");
ser.setOutputCharStream(destination);
if (wnode.getNodeType() == Node.DOCUMENT_NODE) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
ser._format.setEncoding(encoding);
OutputStream outputStream = destination.getByteStream();
Writer writer = destination.getCharacterStream();
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
ser._format.setEncoding(encoding);
OutputStream outputStream = destination.getByteStream();
Writer writer = destination.getCharacterStream();
内容来源于网络,如有侵权,请联系作者删除!