Package org.ujorm.tools.xml.builder
Class XmlPrinter
java.lang.Object
org.ujorm.tools.xml.AbstractWriter
org.ujorm.tools.xml.builder.XmlPrinter
If you need special formatting, overwrite responsible methods.
- Since:
- 1.88
- Author:
- Pavel Ponec
- See Also:
-
Field Summary
Fields inherited from class org.ujorm.tools.xml.AbstractWriter
CDATA_BEG, CDATA_END, COMMENT_BEG, COMMENT_END, config, FORMATTER, FORWARD_SLASH, HTML_DOCTYPE, indentationEnabled, NBSP, out, SPACE, XML_2QUOT, XML_AMPERSAND, XML_APOSTROPHE, XML_GT, XML_HEADER, XML_LT -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor a zero offsetXmlPrinter(@NotNull Appendable out) Writer constructor with a zero offsetXmlPrinter(@NotNull Appendable out, @Nullable XmlConfig config) A writer constructor -
Method Summary
Modifier and TypeMethodDescriptioncreateElement(@NotNull String name) Create any elementstatic XmlPrinterforHtml()Create a new instance including a DOCTYPE.static XmlPrinterCreate XmlPrinter for UTF-8static XmlPrinterforHtml(@NotNull Object httpServletResponse, @NotNull Charset charset, @NotNull String indentationSpace, boolean noCache) Create XmlPrinter for UTF-8static XmlPrinterforHtml(@NotNull Object httpServletResponse, @NotNull HtmlConfig config) Create XmlPrinter for UTF-8.static <T> XmlPrinterforHtml(@Nullable Appendable out, @NotNull HtmlConfig config) Create XmlPrinter for UTF-8static XmlPrinterforHtml(Appendable out) Create a new instance including a DOCTYPEstatic XmlPrinterforNiceHtml(@NotNull Object httpServletResponse) Create XmlPrinter for UTF-8static XmlPrinterforNiceHtml(Appendable out) Create a new instance including a DOCTYPEstatic XmlPrinterCreate a new instance with a formatted output.static XmlPrinterforXml()Create a new instance including a XML_HEADER.static XmlPrinterforXml(@Nullable Appendable out, @NotNull XmlConfig config) A basic XmlPrinter factory method.@NotNull StringtoString()protected voidwriteRawValue(@NotNull Object rawValue, @NotNull XmlBuilder element) Write the content of an envelopeMethods inherited from class org.ujorm.tools.xml.AbstractWriter
createWriter, getWriter, getWriterEscaped, write, writeNewLine, writeRawValue, writeValue
-
Constructor Details
-
XmlPrinter
public XmlPrinter()Default constructor a zero offset -
XmlPrinter
Writer constructor with a zero offset -
XmlPrinter
A writer constructor- Parameters:
out- A writerconfig- A configuration object
-
-
Method Details
-
writeRawValue
protected void writeRawValue(@NotNull @NotNull Object rawValue, @NotNull @NotNull XmlBuilder element) throws IOException Write the content of an envelope- Parameters:
rawValue- A raw value to printelement- An original element- Throws:
IOException
-
toString
- Overrides:
toStringin classAbstractWriter
-
createElement
Create any element- Throws:
IOException
-
forXml
Create a new instance including a XML_HEADER. The result provides a methodtoString() -
forNiceXml
Create a new instance with a formatted output. The result provides a methodtoString()- Returns:
- New instance of the XmlPrinter
-
forXml
public static XmlPrinter forXml(@Nullable @Nullable Appendable out, @NotNull @NotNull XmlConfig config) A basic XmlPrinter factory method. The result provides a methodtoString()- Returns:
- New instance of the XmlPrinter
-
forHtml
Create a new instance including a DOCTYPE. The result provides a methodtoString() -
forHtml
Create a new instance including a DOCTYPE -
forNiceHtml
Create a new instance including a DOCTYPE -
forHtml
Create XmlPrinter for UTF-8- Throws:
IOException
-
forNiceHtml
public static XmlPrinter forNiceHtml(@NotNull @NotNull Object httpServletResponse) throws IOException Create XmlPrinter for UTF-8- Throws:
IOException
-
forHtml
public static <T> XmlPrinter forHtml(@Nullable @Nullable Appendable out, @NotNull @NotNull HtmlConfig config) Create XmlPrinter for UTF-8 -
forHtml
public static XmlPrinter forHtml(@NotNull @NotNull Object httpServletResponse, @NotNull @NotNull Charset charset, @NotNull @NotNull String indentationSpace, boolean noCache) throws IOException Create XmlPrinter for UTF-8- Throws:
IOException
-
forHtml
public static XmlPrinter forHtml(@NotNull @NotNull Object httpServletResponse, @NotNull @NotNull HtmlConfig config) throws IOException Create XmlPrinter for UTF-8. The basic HTML factory.- Throws:
IOException
-