Class XTCESchemaErrorHandler

  • All Implemented Interfaces:
    jakarta.xml.bind.ValidationEventHandler, ErrorHandler

    public class XTCESchemaErrorHandler
    extends Object
    implements ErrorHandler, jakarta.xml.bind.ValidationEventHandler
    A class for instantiating an error handler to catch the warnings and errors that are returned by the SAX XML parser.
    Author:
    David Overeem
    • Constructor Detail

      • XTCESchemaErrorHandler

        public XTCESchemaErrorHandler()
        Constructor
    • Method Detail

      • error

        public void error​(SAXParseException ex)
        Method to capture errors from the SAX parser.
        Specified by:
        error in interface ErrorHandler
        Parameters:
        ex - Exception received from SAX to interrogate.
      • warning

        public void warning​(SAXParseException ex)
        Method to capture warnings from the SAX parser.
        Specified by:
        warning in interface ErrorHandler
        Parameters:
        ex - Exception received from SAX to interrogate.
      • fatalError

        public void fatalError​(SAXParseException ex)
        Method to capture fatal errors from the SAX parser.
        Specified by:
        fatalError in interface ErrorHandler
        Parameters:
        ex - Exception received from SAX to interrogate.
      • fatalError

        public void fatalError​(SAXException ex)
        Method to capture fatal errors from the SAX parser.
        Parameters:
        ex - Exception received from SAX to interrogate.
      • fatalError

        public void fatalError​(IOException ex)
        Method to capture fatal errors from the SAX parser.
        Parameters:
        ex - Exception received from file reading to interrogate.
      • handleEvent

        public boolean handleEvent​(jakarta.xml.bind.ValidationEvent event)
        Method to capture schema validation events that occur during the JAXB unmarshal operation.
        Specified by:
        handleEvent in interface jakarta.xml.bind.ValidationEventHandler
        Parameters:
        event - ValidationEvent containing the message of interest.
        Returns:
        true unless the event is null, then it is false.
      • getMessages

        public List<String> getMessages()
        Retrieve the list of messages collected by SAX during validation of the XTCE document.
        Returns:
        List of Strings that were collected from the parser.
      • getWarningCount

        public long getWarningCount()
        Retrieve the count of the warnings that were logged by SAX during validation of the XTCE document.
        Returns:
        long containing the count.
      • getErrorCount

        public long getErrorCount()
        Retrieve the count of the errors that were logged by SAX during validation of the XTCE document.
        Returns:
        long containing the count.