public class CommonXmlWriter extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CDATA_BEG
A CDATA beg markup sequence
|
static String |
CDATA_END
A CDATA end markup sequence
|
static String |
COMMENT_BEG
A comment beg sequence
|
static String |
COMMENT_END
A comment end sequence
|
static char |
FORWARD_SLASH
A forward slash character
|
static char |
CHAR_NEW_LINE
A new line character
|
static char |
CHAR_SPACE
A special XML character
|
protected boolean |
indentationEnabled
An indentation request
|
protected String |
indentationSpace
An intendation space
|
protected Appendable |
out
Output
|
static char |
XML_2QUOT
A special XML character
|
static char |
XML_AMPERSAND
A special XML character
|
static char |
XML_APOSTROPHE
A special XML character
|
static char |
XML_GT
A special XML character
|
static char |
XML_LT
A special XML character
|
| Constructor and Description |
|---|
CommonXmlWriter(Appendable out,
String indentationSpace)
A writer constructor
|
| Modifier and Type | Method and Description |
|---|---|
static Writer |
createWriter(Object httpServletResponse,
Charset charset,
boolean noCache)
Assign a no-cache and an Edge compatibility mode and returns a writer from HttpServletResponse
|
String |
toString() |
void |
write(CharSequence text,
boolean attribute)
Write escaped value to the output
|
void |
writeNewLine(int level)
Write a new line with an offset by the current level
|
void |
writeRawValue(Object rawValue,
AbstractElement element)
Write the content of an envelope
|
void |
writeValue(Object value,
AbstractElement element,
String attribute)
Write escaped value to the output
|
public static final char XML_GT
public static final char XML_LT
public static final char XML_AMPERSAND
public static final char XML_APOSTROPHE
public static final char XML_2QUOT
public static final char CHAR_SPACE
public static final char CHAR_NEW_LINE
public static final char FORWARD_SLASH
public static final String CDATA_BEG
public static final String CDATA_END
public static final String COMMENT_BEG
public static final String COMMENT_END
@Nonnull protected final Appendable out
protected final boolean indentationEnabled
public CommonXmlWriter(@Nonnull Appendable out, @Nullable String indentationSpace)
out - A writerindentationSpace - String for a one level indentation.public void write(@Nonnull CharSequence text, boolean attribute) throws IOException
text - A value to writeattribute - Write an attribute valueIOExceptionpublic void writeValue(@Nullable Object value, @Nonnull AbstractElement element, @Nullable String attribute) throws IOException
value - A value to writeelement - The elementattribute - A name of the XML attribute of null value for a XML text.IOExceptionpublic void writeRawValue(@Nonnull Object rawValue, @Nonnull AbstractElement element) throws IOException
rawValue - A raw value to printelement - An original elementIOExceptionpublic void writeNewLine(int level)
throws IOException
IOExceptionpublic static Writer createWriter(@Nonnull Object httpServletResponse, @Nonnull Charset charset, boolean noCache) throws ReflectiveOperationException
ReflectiveOperationExceptionCopyright 2015, Pavel Ponec