Interface ResultHandler

All Known Implementing Classes:
Parser.XmlSerializer

public interface ResultHandler
Receives a parse result as serialization-style callbacks.

The default Parser.parse(String, de.bottlecaps.markup.blitz.Parser.Option...) method serializes the parse tree to an XML string. By supplying an implementation of this interface to Parser.parse(String, ResultHandler, de.bottlecaps.markup.blitz.Parser.Option...), a caller can instead build a result representation of its choice (for example a tree in a host language) directly from the parse tree, without an intervening serialized form.

An element's attributes are reported by attribute(String, int[], int), after its startElement(String) and before any child content.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    attribute(String name, int[] codepoints, int length)
    Reports an attribute, with its value given as codepoints.
    void
    Reports the end of an element.
    void
    Reports the start of an element.
    void
    text(int[] codepoints, int length)
    Reports a run of codepoints of element content.
  • Method Details

    • startElement

      void startElement(String name)
      Reports the start of an element.
      Parameters:
      name - the element name
    • endElement

      void endElement(String name)
      Reports the end of an element.
      Parameters:
      name - the element name
    • attribute

      void attribute(String name, int[] codepoints, int length)
      Reports an attribute, with its value given as codepoints.
      Parameters:
      name - the attribute name
      codepoints - the codepoints holding the attribute value
      length - the number of codepoints in the value
    • text

      void text(int[] codepoints, int length)
      Reports a run of codepoints of element content.
      Parameters:
      codepoints - the Unicode code points
      length - the number of codepoints to report