All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.okworx.ilcd.validation.util.SchemaErrorHandler Maven / Gradle / Ivy

Go to download

A Java library for performing technical validation of data in ILCD data format.

There is a newer version: 2.7.2
Show newest version
package com.okworx.ilcd.validation.util;

import java.util.Collection;
import java.util.concurrent.ConcurrentLinkedQueue;

import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

import com.okworx.ilcd.validation.SchemaValidator;
import com.okworx.ilcd.validation.events.IValidationEvent;
import com.okworx.ilcd.validation.events.Severity;
import com.okworx.ilcd.validation.events.ValidationEvent;
import com.okworx.ilcd.validation.reference.IDatasetReference;

/**
 * 

SchemaErrorHandler class.

* * @author oliver.kusche * @version $Id: $Id */ public class SchemaErrorHandler implements ErrorHandler { private IDatasetReference reference; private SchemaValidator validator; private ConcurrentLinkedQueue events = new ConcurrentLinkedQueue(); /** *

Constructor for SchemaErrorHandler.

* * @param schemaValidator a {@link com.okworx.ilcd.validation.SchemaValidator} object. */ public SchemaErrorHandler(SchemaValidator schemaValidator) { this.validator = schemaValidator; } /** *

Getter for the field events.

* * @return a {@link java.util.Collection} object. */ public Collection getEvents() { return events; } /** *

Getter for the field reference.

* * @return a {@link com.okworx.ilcd.validation.reference.IDatasetReference} object. */ public IDatasetReference getReference() { return reference; } /** *

Setter for the field reference.

* * @param reference a {@link com.okworx.ilcd.validation.reference.IDatasetReference} object. */ public void setReference(IDatasetReference reference) { this.reference = reference; } /** {@inheritDoc} */ public void error(SAXParseException arg0) throws SAXException { this.events.add(new ValidationEvent(this.validator.getAspectName(), Severity.ERROR, this.reference, arg0.getLineNumber() + "," + arg0.getColumnNumber() + " " + arg0.getMessage())); } /** {@inheritDoc} */ public void fatalError(SAXParseException arg0) throws SAXException { this.events.add(new ValidationEvent(this.validator.getAspectName(), Severity.ERROR, this.reference, arg0.getMessage())); } /** {@inheritDoc} */ public void warning(SAXParseException arg0) throws SAXException { this.events.add(new ValidationEvent(this.validator.getAspectName(), Severity.WARNING, this.reference, arg0.getMessage())); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy