Example usage for org.xml.sax SAXParseException getSystemId

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

Introduction

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

Prototype

public String getSystemId() 

Source Link

Document

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

Usage

From source file:net.ontopia.topicmaps.entry.XMLConfigSource.java

private static List<TopicMapSourceIF> readSources(InputSource inp_source, Map<String, String> environ) {
    ConfigHandler handler = new ConfigHandler(environ);

    try {//from  w  w  w .jav  a  2 s.  com
        XMLReader parser = DefaultXMLReaderFactory.createXMLReader();
        parser.setContentHandler(handler);
        parser.setErrorHandler(new Slf4jSaxErrorHandler(log));
        parser.parse(inp_source);
    } catch (SAXParseException e) {
        String msg = "" + e.getSystemId() + ":" + e.getLineNumber() + ":" + e.getColumnNumber() + ": "
                + e.getMessage();
        throw new OntopiaRuntimeException(msg, e);
    } catch (Exception e) {
        throw new OntopiaRuntimeException(e);
    }
    return handler.sources;
}

From source file:Main.java

private void printInfo(SAXParseException e) {
    System.out.println("   Public ID: " + e.getPublicId());
    System.out.println("   System ID: " + e.getSystemId());
    System.out.println("   Line number: " + e.getLineNumber());
    System.out.println("   Column number: " + e.getColumnNumber());
    System.out.println("   Message: " + e.getMessage());
}

From source file:org.wikipedia.vlsergey.secretary.utils.DefaultErrorHandler.java

protected StringBuffer getText(SAXParseException exc, String type) {
    StringBuffer errorMessage = new StringBuffer();
    if (exc.getSystemId() != null) {
        errorMessage.append("[");
        errorMessage.append(exc.getSystemId());
        errorMessage.append("] ");
    }/*from ww w.  j av a2 s. c o  m*/
    errorMessage.append("XML ");
    errorMessage.append(type);
    errorMessage.append(": ");
    errorMessage.append(exc.getMessage());

    // String around = XMLTools.getSourceTextAround(exc);
    // if (around != null) {
    // errorMessage.append(":\n");
    // errorMessage.append(around);
    // errorMessage.append("\n");
    // }
    return errorMessage;
}

From source file:javasnack.snacks.xml.sax2.DebugPrinter.java

void saxerr(String level, SAXParseException e) {
    oops("%s : SAXParserException(line:%d, column:%d, publicId:%s, systemId:%s)", level, e.getLineNumber(),
            e.getColumnNumber(), e.getPublicId(), e.getSystemId());
    oops(e.toString());//from   ww  w .j a  v  a 2  s  .  co  m
    oops("...continue");
}

From source file:DOMCheck.java

private void show(String type, SAXParseException e) {
    System.out.println(type + ": " + e.getMessage());
    System.out.println("Line " + e.getLineNumber() + " Column " + e.getColumnNumber());
    System.out.println("System ID: " + e.getSystemId());
}

From source file:org.slc.sli.ingestion.validation.XsdErrorHandler.java

/**
 * Incorporate the SAX error message into an ingestion error message.
 *
 * @param saxErrorMessage// ww w.j a va  2s.  com
 *            Error message returned by SAX
 * @return Error message returned by Ingestion
 */
private String getErrorMessage(SAXParseException ex) {
    // Create an ingestion error message incorporating the SAXParseException information.
    String fullParsefilePathname = (ex.getSystemId() == null) ? "" : ex.getSystemId();
    File parseFile = new File(fullParsefilePathname);

    // Return the ingestion error message.
    return MessageSourceHelper.getMessage(messageSource, "XSD_VALIDATION_ERROR", parseFile.getName(),
            String.valueOf(ex.getLineNumber()), String.valueOf(ex.getColumnNumber()), ex.getMessage());
}

From source file:gov.nih.nci.cabig.caaers.esb.client.ESBMessageConsumerImpl.java

public void error(SAXParseException exception) throws SAXException {
    // Bring things to a crashing halt
    log.warn("**Parsing Error**" + "  Line:    " + exception.getLineNumber() + "" + "  URI:     "
            + exception.getSystemId() + "" + "  Message: " + exception.getMessage());
    throw new SAXException("Error encountered");
}

From source file:gov.nih.nci.cabig.caaers.esb.client.ESBMessageConsumerImpl.java

public void warning(SAXParseException exception) throws SAXException {
    // Bring things to a crashing halt
    log.warn("**Parsing Warning**" + "  Line:    " + exception.getLineNumber() + "" + "  URI:     "
            + exception.getSystemId() + "" + "  Message: " + exception.getMessage());
    throw new SAXException("Warning encountered");
}

From source file:gov.nih.nci.cabig.caaers.esb.client.ESBMessageConsumerImpl.java

public void fatalError(SAXParseException exception) throws SAXException {
    // Bring things to a crashing halt
    log.warn("**Parsing Fatal Error**" + "  Line:    " + exception.getLineNumber() + "" + "  URI:     "
            + exception.getSystemId() + "" + "  Message: " + exception.getMessage());
    throw new SAXException("Fatal Error encountered");
}

From source file:DOMCopy.java

private void show(String type, SAXParseException e) {
        System.out.println(type + ": " + e.getMessage());
        System.out.println("Line " + e.getLineNumber() + " Column " + e.getColumnNumber());
        System.out.println("System ID: " + e.getSystemId());
    }//w ww .ja v  a  2  s . co  m