Class XmlPrinter

java.lang.Object
org.ujorm.tools.xml.AbstractWriter
org.ujorm.tools.xml.builder.XmlPrinter

public class XmlPrinter extends AbstractWriter
If you need special formatting, overwrite responsible methods.
Since:
1.88
Author:
Pavel Ponec
See Also:
  • Constructor Details

    • XmlPrinter

      public XmlPrinter()
      Default constructor a zero offset
    • XmlPrinter

      public XmlPrinter(@NotNull @NotNull Appendable out)
      Writer constructor with a zero offset
    • XmlPrinter

      public XmlPrinter(@NotNull @NotNull Appendable out, @Nullable @Nullable XmlConfig config)
      A writer constructor
      Parameters:
      out - A writer
      config - 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 print
      element - An original element
      Throws:
      IOException
    • toString

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class AbstractWriter
    • createElement

      public XmlBuilder createElement(@NotNull @NotNull String name) throws IOException
      Create any element
      Throws:
      IOException
    • forXml

      public static XmlPrinter forXml()
      Create a new instance including a XML_HEADER. The result provides a method toString()
    • forNiceXml

      public static XmlPrinter forNiceXml()
      Create a new instance with a formatted output. The result provides a method toString()
      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 method toString()
      Returns:
      New instance of the XmlPrinter
    • forHtml

      public static XmlPrinter forHtml()
      Create a new instance including a DOCTYPE. The result provides a method toString()
    • forHtml

      public static XmlPrinter forHtml(Appendable out)
      Create a new instance including a DOCTYPE
    • forNiceHtml

      public static XmlPrinter forNiceHtml(Appendable out)
      Create a new instance including a DOCTYPE
    • forHtml

      public static XmlPrinter forHtml(@NotNull @NotNull Object httpServletResponse) throws IOException
      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