Class XmlTemplate


public class XmlTemplate extends XmlFragment
Describes the XML an XmlWriter produces: nodes before the XmlNodeContainer.detail() marker form the header, the marker's nodes are written once per record and the remaining nodes form the footer.
  • Constructor Details

    • XmlTemplate

      public XmlTemplate()
  • Method Details

    • getDeclaration

      public String getDeclaration()
      Returns the text written verbatim on its own line before the template's nodes, typically an XML declaration (default is null, for none).
    • setDeclaration

      public XmlTemplate setDeclaration(String declaration)
      Sets the text written verbatim on its own line before the template's nodes, typically an XML declaration (default is null, for none).
    • setValue

      public void setValue(String name, Object value)
      Sets a named value that the template's expressions, including per-record ones, can reference.
    • setValue

      public void setValue(String name, Object value, Class<?> type)
      Sets a named value of the given type that the template's expressions, including per-record ones, can reference.
    • buildHeader

      public void buildHeader(CodeWriter writer) throws IOException
      Writes the declaration and the nodes that come before the detail marker; call it once before writing records.
      Throws:
      IOException
    • buildDetail

      public void buildDetail(Record record, CodeWriter writer) throws IOException
      Writes the detail marker's nodes for the given record; throws a DataException if buildHeader(CodeWriter) found no detail marker.
      Throws:
      IOException
    • buildFooter

      public void buildFooter(CodeWriter writer) throws IOException
      Writes the nodes after the detail marker, closing the elements the header opened.
      Throws:
      IOException