Class PrintSaxMessager

  • All Implemented Interfaces:
    SaxMessager

    public class PrintSaxMessager
    extends java.lang.Object
    implements SaxMessager
    SaxMessager implementation that writes messages to a given print stream. An effort is made not to output the same message millions of times. The maximum number of times the same message will be output is controlled by the maxRepeat parameter.
    Since:
    29 Nov 2017
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      PrintSaxMessager​(java.io.PrintStream out, boolean debug, int maxRepeat)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void reportMessage​(SaxMessager.Level level, java.lang.String msg, org.xml.sax.Locator locator)
      Reports a message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrintSaxMessager

        public PrintSaxMessager​(java.io.PrintStream out,
                                boolean debug,
                                int maxRepeat)
        Constructor.
        Parameters:
        out - output stream to which messages will be written
        debug - if true, a stack trace will be output with each log message
        maxRepeat - maximum number of identical error messages which will be logged
    • Method Detail

      • reportMessage

        public void reportMessage​(SaxMessager.Level level,
                                  java.lang.String msg,
                                  org.xml.sax.Locator locator)
        Description copied from interface: SaxMessager
        Reports a message.
        Specified by:
        reportMessage in interface SaxMessager
        Parameters:
        level - severity level of the message, not null
        msg - message text
        locator - location in the XML document that provoked the message, or null if unknown/inapplicable