@NotThreadSafe public class XMLWriterSettings extends Object implements IXMLWriterSettings, com.helger.commons.lang.ICloneable<XMLWriterSettings>
IXMLWriterSettings interface.| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_EMIT_NAMESPACES
By default namespaces are written.
|
static String |
DEFAULT_INDENTATION_STRING
By default indentation happens with 2 spaces
|
static boolean |
DEFAULT_PUT_NAMESPACE_CONTEXT_PREFIXES_IN_ROOT
By default namespace context prefixes are put inside the root element
|
static boolean |
DEFAULT_SPACE_ON_SELF_CLOSED_ELEMENT
By default a leading space is inserted before a self closed element (e.g.
|
static boolean |
DEFAULT_USE_DOUBLE_QUOTES_FOR_ATTRIBUTES
By default double quotes are used to wrap attribute values
|
static String |
DEFAULT_XML_CHARSET
The default charset is UTF-8
|
static Charset |
DEFAULT_XML_CHARSET_OBJ
The default charset is UTF-8
|
static IXMLWriterSettings |
DEFAULT_XML_SETTINGS
The default settings to use
|
| Constructor and Description |
|---|
XMLWriterSettings()
Creates a default settings object with the following settings:
XML version 1.0
with XML declaration
with document type
with comments
Indented and aligned
Writing invalid characters to the file as is - may result in invalid
XML files
Default character set UTF-8
No namespace context
|
XMLWriterSettings(IXMLWriterSettings aOther)
Copy constructor.
|
public static final String DEFAULT_XML_CHARSET
public static final Charset DEFAULT_XML_CHARSET_OBJ
public static final boolean DEFAULT_USE_DOUBLE_QUOTES_FOR_ATTRIBUTES
public static final boolean DEFAULT_SPACE_ON_SELF_CLOSED_ELEMENT
<b /> in contrast to <b/>).public static final String DEFAULT_INDENTATION_STRING
public static final boolean DEFAULT_EMIT_NAMESPACES
public static final boolean DEFAULT_PUT_NAMESPACE_CONTEXT_PREFIXES_IN_ROOT
public static final IXMLWriterSettings DEFAULT_XML_SETTINGS
public XMLWriterSettings()
public XMLWriterSettings(@Nonnull IXMLWriterSettings aOther)
aOther - The object to copy the settings from. May not be null.@Nonnull public EXMLVersion getXMLVersion()
getXMLVersion in interface IXMLWriterSettings1.0@Nonnull public final XMLWriterSettings setSerializeVersion(@Nonnull EXMLSerializeVersion eSerializeVersion)
eSerializeVersion - The XML serialize version. May not be null.@Nonnull public EXMLSerializeVersion getSerializeVersion()
getSerializeVersion in interface IXMLWriterSettingsXML 1.0@Nonnull public final XMLWriterSettings setSerializeXMLDeclaration(@Nonnull EXMLSerializeXMLDeclaration eSerializeXMLDecl)
eSerializeXMLDecl - XML declaration handling. May not be null.@Nonnull public EXMLSerializeXMLDeclaration getSerializeXMLDeclaration()
getSerializeXMLDeclaration in interface IXMLWriterSettingstrue.@Nonnull public final XMLWriterSettings setSerializeDocType(@Nonnull EXMLSerializeDocType eSerializeDocType)
eSerializeDocType - Doc type handling. May not be null.@Nonnull public EXMLSerializeDocType getSerializeDocType()
getSerializeDocType in interface IXMLWriterSettingstrue.@Nonnull public final XMLWriterSettings setSerializeComments(@Nonnull EXMLSerializeComments eSerializeComments)
eSerializeComments - The comment handling. May not be null.@Nonnull public EXMLSerializeComments getSerializeComments()
getSerializeComments in interface IXMLWriterSettingstrue.@Nonnull public final XMLWriterSettings setIndent(@Nonnull EXMLSerializeIndent eIndent)
eIndent - Indent and align definition. May not be null.@Nonnull public EXMLSerializeIndent getIndent()
getIndent in interface IXMLWriterSettingsindent and aligned.@Nonnull public final XMLWriterSettings setIndentDeterminator(@Nonnull IXMLIndentDeterminator aIndentDeterminator)
aIndentDeterminator - The object to use. May not be null.@Nonnull public IXMLIndentDeterminator getIndentDeterminator()
getIndentDeterminator in interface IXMLWriterSettingsnull.@Nonnull public final XMLWriterSettings setIncorrectCharacterHandling(@Nonnull EXMLIncorrectCharacterHandling eIncorrectCharacterHandling)
eIncorrectCharacterHandling - The invalid character handling. May not be null.@Nonnull public EXMLIncorrectCharacterHandling getIncorrectCharacterHandling()
getIncorrectCharacterHandling in interface IXMLWriterSettingsnull.@Nonnull public final XMLWriterSettings setCharset(@Nonnull Charset aCharset)
aCharset - The charset to be used. May not be null.@Nonnull public Charset getCharset()
getCharset in interface IXMLWriterSettingsnull.@Nonnull public final XMLWriterSettings setNamespaceContext(@Nullable INamespaceContext aNamespaceContext)
aNamespaceContext - The namespace context to be used. May be null.@Nonnull public INamespaceContext getNamespaceContext()
getNamespaceContext in interface IXMLWriterSettingsnull.@Nonnull public final XMLWriterSettings setUseDoubleQuotesForAttributes(boolean bUseDoubleQuotesForAttributes)
public boolean isUseDoubleQuotesForAttributes()
isUseDoubleQuotesForAttributes in interface IXMLWriterSettingstrue if attribute values should be enclosed in double
quotes, false if single quotes should be used.@Nonnull public final XMLWriterSettings setBracketModeDeterminator(@Nonnull IXMLBracketModeDeterminator aBracketModeDeterminator)
@Nonnull public IXMLBracketModeDeterminator getBracketModeDeterminator()
getBracketModeDeterminator in interface IXMLWriterSettingsnull
.@Nonnull public final XMLWriterSettings setSpaceOnSelfClosedElement(boolean bSpaceOnSelfClosedElement)
public boolean isSpaceOnSelfClosedElement()
IXMLWriterSettings<br />) or not (
<br/>)isSpaceOnSelfClosedElement in interface IXMLWriterSettingstrue if a space should be emitted, false
if no space should be emitted.@Nonnull public final XMLWriterSettings setNewLineMode(@Nonnull com.helger.commons.system.ENewLineMode eNewLineMode)
@Nonnull public com.helger.commons.system.ENewLineMode getNewLineMode()
getNewLineMode in interface IXMLWriterSettingsnull.@Nonnull @Nonempty public String getNewLineString()
getNewLineString in interface IXMLWriterSettingsgetNewLineMode ().getText().@Nonnull public final XMLWriterSettings setIndentationString(@Nonnull @Nonempty String sIndentationString)
@Nonnull @Nonempty public String getIndentationString()
getIndentationString in interface IXMLWriterSettings@Nonnull public final XMLWriterSettings setEmitNamespaces(boolean bEmitNamespaces)
public boolean isEmitNamespaces()
IXMLWriterSettingsisEmitNamespaces in interface IXMLWriterSettingstrue if namespaces should be emitted,
false if all created elements should reside in the
default namespace.@Nonnull public final XMLWriterSettings setPutNamespaceContextPrefixesInRoot(boolean bPutNamespaceContextPrefixesInRoot)
public boolean isPutNamespaceContextPrefixesInRoot()
IXMLWriterSettingsIIterableNamespaceContext interface!isPutNamespaceContextPrefixesInRoot in interface IXMLWriterSettingstrue if it is enabled, false if not.@Nonnull public XMLWriterSettings getClone()
getClone in interface com.helger.commons.lang.ICloneable<XMLWriterSettings>@Nonnull @ReturnsMutableCopy public static XMLWriterSettings createForHTML4()
@Nonnull @ReturnsMutableCopy public static XMLWriterSettings createForXHTML()
@Nonnull @ReturnsMutableCopy public static XMLWriterSettings createForHTML5()
Copyright © 2014–2018 Philip Helger. All rights reserved.