Example usage for org.xml.sax SAXParseException getColumnNumber

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

Introduction

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

Prototype

public int getColumnNumber() 

Source Link

Document

The column number of the end of the text where the exception occurred.

Usage

From source file:org.orbeon.oxf.xml.dom4j.LocationData.java

public LocationData(SAXParseException exception) {
    systemID = exception.getSystemId();
    line = exception.getLineNumber();
    col = exception.getColumnNumber();
}

From source file:org.plasma.sdo.xml.DefaultErrorHandler.java

public void error(SAXParseException e) throws SAXException {
    String msg = "line:column[" + e.getLineNumber() + ":" + e.getColumnNumber() + "]";
    msg += " - " + e.getMessage();
    if (options.isFailOnValidationError()) {
        throw new SAXParseException(msg, new ErrorLocator(e));
    } else {//from w w  w.  j a  v  a 2s  .c o m
        if (options.getValidationLog() != null) {
            options.getValidationLog().error(msg);
        } else
            log.error(msg);
    }
}

From source file:org.plasma.sdo.xml.DefaultErrorHandler.java

public void fatalError(SAXParseException e) throws SAXException {
    String msg = "line:column[" + e.getLineNumber() + ":" + e.getColumnNumber() + "]";
    msg += " - " + e.getMessage();
    if (options.isFailOnValidationError()) {
        throw new SAXParseException(msg, new ErrorLocator(e));
    } else {/*from   w w w  .ja  v a2  s. c om*/
        if (options.getValidationLog() != null) {
            options.getValidationLog().fatal(msg);
        } else
            log.fatal(msg);
    }
}

From source file:org.plasma.sdo.xml.DefaultErrorHandler.java

public void warning(SAXParseException e) throws SAXException {
    String msg = "line:column[" + e.getLineNumber() + ":" + e.getColumnNumber() + "]";
    msg += " - " + e.getMessage();
    if (options.getValidationLog() != null) {
        options.getValidationLog().warn(msg);
    } else//  w w  w.  j ava  2  s .  co  m
        log.warn(msg);
}

From source file:org.roda.core.common.validation.ValidationUtils.java

private static ValidationIssue convertSAXParseException(SAXParseException e) {
    ValidationIssue issue = new ValidationIssue();
    issue.setMessage(e.getMessage());//from   www. jav a 2s  .  com
    issue.setLineNumber(e.getLineNumber());
    issue.setColumnNumber(e.getColumnNumber());

    return issue;
}

From source file:org.solenopsis.checkstyle.ConfigurationLoader.java

/**
 * Returns the module configurations from a specified input source.
 * Note that if the source does wrap an open byte or character
 * stream, clients are required to close that stream by themselves
 *
 * @param configSource the input stream to the Checkstyle configuration
 * @param overridePropsResolver overriding properties
 * @param omitIgnoredModules {@code true} if modules with severity
 *            'ignore' should be omitted, {@code false} otherwise
 * @return the check configurations/*from  w  w  w .  j  a  v a  2  s  .  com*/
 * @throws CheckstyleException if an error occurs
 */
public static Configuration loadConfiguration(InputSource configSource, PropertyResolver overridePropsResolver,
        boolean omitIgnoredModules) throws CheckstyleException {
    try {
        final ConfigurationLoader loader = new ConfigurationLoader(overridePropsResolver, omitIgnoredModules);
        loader.parseInputSource(configSource);
        return loader.configuration;
    } catch (final SAXParseException ex) {
        final String message = String.format(Locale.ROOT, "%s - %s:%s:%s", UNABLE_TO_PARSE_EXCEPTION_PREFIX,
                ex.getMessage(), ex.getLineNumber(), ex.getColumnNumber());
        throw new CheckstyleException(message, ex);
    } catch (final ParserConfigurationException | IOException | SAXException ex) {
        throw new CheckstyleException(UNABLE_TO_PARSE_EXCEPTION_PREFIX, ex);
    }
}

From source file:org.wso2.carbon.bpel.common.LoggingErrorHandler.java

private String formatMessage(String level, SAXParseException spe) {
    StringBuilder sb = new StringBuilder(64);

    if (spe.getSystemId() != null) {
        sb.append(spe.getSystemId());/*from   w  w w. j av  a2  s .com*/
    }

    sb.append(':');
    sb.append(spe.getLineNumber());
    sb.append(':');
    sb.append(spe.getColumnNumber());
    sb.append(':');
    sb.append(level);
    sb.append(':');
    sb.append(spe.getMessage());

    return sb.toString();
}

From source file:org.yawlfoundation.yawl.unmarshal.YawlXMLSpecificationValidator.java

private String getLineNumber(SAXParseException e) {
    return (e.getSystemId() != null) ? "[ln: " + e.getLineNumber() + " col: " + e.getColumnNumber() + "]" : "";
}

From source file:pl.nask.hsn2.workflow.parser.HWLParser.java

private WorkflowSyntaxException makeWorkflowSyntaxException(JAXBException e) {
    int lineNo = -1;
    int colNo = -1;
    String msg = e.getMessage();//from  w ww . j a  v a  2  s  .  c o  m
    if (e.getLinkedException() instanceof SAXParseException) {
        SAXParseException linked = (SAXParseException) e.getLinkedException();
        lineNo = linked.getLineNumber();
        colNo = linked.getColumnNumber();
        msg = linked.getMessage();
    }

    return new WorkflowSyntaxException(e, lineNo, colNo, msg);
}

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

/**
 * @see stroom.pipeline.server.filter.AbstractXMLFilter#startProcessing()
 *//*from   w w w .j  a  v a2 s .c  om*/
@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();
    }
}