Package org.ujorm.tools.xml
Class AbstractWriter
java.lang.Object
org.ujorm.tools.xml.AbstractWriter
- Direct Known Subclasses:
XmlPrinter,XmlWriter
A generic writer
- Author:
- Pavel Ponec
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA CDATA beg markup sequencestatic final StringA CDATA end markup sequencestatic final StringA comment beg sequencestatic final StringA comment end sequenceprotected final @NotNull XmlConfigXML configurationstatic final MsgFormatterCommon formatterstatic final charA forward slash characterstatic final StringDefault DOCTYPE of HTML-5protected final booleanAn indentation requeststatic final charNon-breaking space characterprotected final @NotNull AppendableOutputstatic final charA special XML characterstatic final charA special XML characterstatic final charA special XML characterstatic final charA special XML characterstatic final charA special XML characterstatic final StringDefault XML declarationstatic final charA special XML character -
Constructor Summary
ConstructorsConstructorDescriptionAbstractWriter(@NotNull Appendable out, @NotNull XmlConfig config) A writer constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull AppendablecreateWriter(@NotNull Object httpServletResponse, @NotNull Charset charset, boolean noCache) Assign a no-cache and an Edge compatibility mode and returns a writer from HttpServletResponse@NotNull AppendableFor internal usage only@NotNull AppendableGet Writer to escape HTML characters.toString()final voidwrite(@NotNull CharSequence text, boolean attribute) Write escaped value to the outputvoidwriteNewLine(int level) Write a new line with an offset by the current levelfinal voidwriteRawValue(@NotNull CharSequence rawValue, @NotNull ApiElement element) Write the content of an envelopevoidwriteValue(@Nullable Object value, @NotNull ApiElement element, @Nullable String attributeName) Write escaped value to the output
-
Field Details
-
XML_HEADER
Default XML declaration- See Also:
-
HTML_DOCTYPE
Default DOCTYPE of HTML-5- See Also:
-
XML_GT
public static final char XML_GTA special XML character- See Also:
-
XML_LT
public static final char XML_LTA special XML character- See Also:
-
XML_AMPERSAND
public static final char XML_AMPERSANDA special XML character- See Also:
-
XML_APOSTROPHE
public static final char XML_APOSTROPHEA special XML character- See Also:
-
XML_2QUOT
public static final char XML_2QUOTA special XML character- See Also:
-
SPACE
public static final char SPACEA special XML character- See Also:
-
NBSP
public static final char NBSPNon-breaking space character- See Also:
-
FORWARD_SLASH
public static final char FORWARD_SLASHA forward slash character- See Also:
-
CDATA_BEG
A CDATA beg markup sequence- See Also:
-
CDATA_END
A CDATA end markup sequence- See Also:
-
COMMENT_BEG
A comment beg sequence- See Also:
-
COMMENT_END
A comment end sequence- See Also:
-
FORMATTER
Common formatter -
out
Output -
config
XML configuration -
indentationEnabled
protected final boolean indentationEnabledAn indentation request
-
-
Constructor Details
-
AbstractWriter
A writer constructor- Parameters:
out- A writerconfig- XML configuration
-
-
Method Details
-
write
Write escaped value to the output- Parameters:
text- A value to writeattribute- Write an attribute value- Throws:
IOException
-
writeValue
public void writeValue(@Nullable @Nullable Object value, @NotNull @NotNull ApiElement element, @Nullable @Nullable String attributeName) throws IOException Write escaped value to the output- Parameters:
value- A value to write, where thenullvalue is ignored silently.element- The elementattributeName- A name of the XML attribute ofnullvalue for a XML text.- Throws:
IOException
-
writeRawValue
public final void writeRawValue(@NotNull @NotNull CharSequence rawValue, @NotNull @NotNull ApiElement element) throws IOException Write the content of an envelope- Parameters:
rawValue- A raw value to printelement- An original element- Throws:
IOException
-
writeNewLine
Write a new line with an offset by the current level- Throws:
IOException
-
toString
-
getWriter
For internal usage only -
getWriterEscaped
Get Writer to escape HTML characters. -
createWriter
@NotNull public static @NotNull Appendable createWriter(@NotNull @NotNull Object httpServletResponse, @NotNull @NotNull Charset charset, boolean noCache) throws ReflectiveOperationException Assign a no-cache and an Edge compatibility mode and returns a writer from HttpServletResponse- Throws:
ReflectiveOperationException
-