Javax.xml.bind.Util.ValidationEventCollector Class



Introduction

The javax.xml.bind.Util.ValidationEventCollector class can be used by creating a new instance and pass it to the setEventHandler method of the Validator, Unmarshaller, Marshaller class. After the call to validate or unmarshal completes, call the getEvents method to retrieve all the reported errors and warnings.

Class declaration

Following is the declaration for javax.xml.bind.Util.ValidationEventCollector class −

public class ValidationEventCollector
   extends Object
      implements ValidationEventHandler

Class constructors

S.N. Constructor & Description
1 ValidationEventCollector()

Single Constructor.

Class methods

S.N. Method & Description
1 ValidationEvent[] getEvents()

This method returns an array of ValidationEvent objects containing a copy of each of the collected errors and warnings.

2 boolean handleEvent(ValidationEvent event)

This method receive notification of a validation warning or error.

3 boolean hasEvents()

This method returns true if this event collector contains at least one ValidationEvent.

4 void reset()

This method clears all collected errors and warnings.

Methods inherited

This class inherits methods from the following classes −

javax.xml.Object

Advertisements