Example usage for org.xml.sax SAXParseException getPublicId

List of usage examples for org.xml.sax SAXParseException getPublicId

Introduction

In this page you can find the example usage for org.xml.sax SAXParseException getPublicId.

Prototype

public String getPublicId() 

Source Link

Document

Get the public identifier of the entity where the exception occurred.

Usage

From source file:stroom.pipeline.server.filter.SchemaFilter.java

/**
 * @see stroom.pipeline.server.filter.AbstractXMLFilter#startProcessing()
 *//*ww  w.  j ava  2  s.  c  o m*/
@Override
public void startProcessing() {
    try {
        if (errorHandler == null) {
            errorHandler = new ErrorHandlerAdaptor(getElementId(), locationFactory, errorReceiverProxy) {
                @Override
                protected void log(final Severity severity, final SAXParseException exception) {
                    String message = exception.getMessage();

                    if (message.contains("cvc-")) {
                        message = CVC_PATTERN.matcher(message).replaceAll("");
                    }
                    if (message.contains("One of")) {
                        message = NS_REDUCTION_PATTERN.matcher(message).replaceAll("");
                    }
                    message = message.trim();

                    final SAXParseException ex = new SAXParseException(message, exception.getPublicId(),
                            exception.getSystemId(), exception.getLineNumber(), exception.getColumnNumber());

                    super.log(severity, ex);
                }
            };
        }

        schemaLocations = null;
        prefixes.clear();
        validator = null;
    } finally {
        super.startProcessing();
    }
}