public class SerializeOptions
extends Object
Options for controlling XML serialization via XmlUtil.serialize.
All options have sensible defaults matching the existing behaviour of
XmlUtil.serialize(), so only options that need to differ from
the defaults need to be specified:
// Groovy named parameters:
XmlUtil.serialize(node, new SerializeOptions(encoding: 'ISO-8859-1', indent: 4))
| Constructor and description |
|---|
SerializeOptions() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Charset |
getCharset()The character encoding as a Charset. |
|
public String |
getEncoding()The character encoding for the XML output. |
|
public int |
getIndent()The number of spaces to use for indentation. |
|
public boolean |
isAllowDocTypeDeclaration()Whether to allow DOCTYPE declarations during serialization. |
|
public void |
setAllowDocTypeDeclaration(boolean allowDocTypeDeclaration) |
|
public void |
setEncoding(String encoding) |
|
public void |
setIndent(int indent) |
The character encoding as a Charset.
The character encoding for the XML output.
Default is "UTF-8".
The number of spaces to use for indentation.
Default is 2.
Whether to allow DOCTYPE declarations during serialization.
Default is false.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.