SAXParseException getPublicId - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SAXParseException getPublicId method.

This code example shows how to use the following methods:getMessage, getColumnNumber, getLineNumber, getPublicId, getSystemId
     * @param ex  PARAM 
     * @return    Returns 
     */ 
    public String print( SAXParseException ex ) {
        StringBuffer sb = new StringBuffer();
        sb.append( "Exception: " + ex.getMessage() );
        sb.append( "failed at column : " + ex.getColumnNumber() +
                " on line " + ex.getLineNumber() );
        sb.append( "entity:\n" + ex.getPublicId() + "\n" + ex.getSystemId() );
        return sb.toString();
    } 
 
    /** 
     * Sets the textArea attribute of the ValidationHandler object 
     * 
     * @param jta  The new textArea value 
     */ 
    public void setTextArea( JTextArea jta ) {
        this.jta = jta;
    } 
7
CodeRank
This code example shows how to use the following methods:getException, getMessage, getColumnNumber, getLineNumber, getPublicId
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
 
    @Override 
    public void error(SAXParseException x) throws SAXException {
        if (loggable) {
            final String msg = "[ERROR] - Unexpected exception while parsing "
                    + "an instance of PUBLIC [" + x.getPublicId()
                    + "], SYSTEM [" + x.getSystemId() + "] - line #"
                    + x.getLineNumber() + ", column #" + x.getColumnNumber();
            if (debug) {
                Context.getCurrentLogger().log(Level.CONFIG, msg, x);
            } else { 
                logger.config(msg + ": " + x.getLocalizedMessage());
            } 
        } 
    } 
 
    @Override 
    public void fatalError(SAXParseException x) throws SAXException {
        if (loggable) {
            final String msg = "[FATAL] - Unexpected exception while parsing "
7
CodeRank
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
            } 
 
            mySink.complete();
 
        } catch (SAXParseException e) {
            throw new OsmosisRuntimeException( 
                    "Unable to parse xml" 
                    + ".  publicId=(" + e.getPublicId()
                    + "), systemId=(" + e.getSystemId()
                    + "), lineNumber=" + e.getLineNumber()
                    + ", columnNumber=" + e.getColumnNumber() + ".",
                    e);
        } catch (SAXException e) {
            throw new OsmosisRuntimeException("Unable to parse XML.", e);
        } catch (IOException e) {
            throw new OsmosisRuntimeException("Unable to read XML.", e);
        } finally { 
            mySink.release();
 
            cleanup(); 
7
CodeRank
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
         * 
         * @throws SAXParseException see above 
         */ 
        public void throwSummary() throws SAXParseException {
            if (firstException != null) {
                throw new SAXParseException(messageBuffer.toString(), firstException.getPublicId(), firstException.getSystemId(), firstException.getLineNumber(), firstException.getColumnNumber(), firstException);
            } 
        } 
 
    } 
 
    /** . */ 
    private static final Logger log = LoggerFactory.getLogger(GateInResourcesSchemaValidator.class); 
 
    /** . */ 
    public static final String GATEIN_RESOURCES_1_0_SYSTEM_ID = "http://www.gatein.org/xml/ns/gatein_resources_1_0";
 
    /** . */ 
    public static final String GATEIN_RESOURCES_1_1_SYSTEM_ID = "http://www.gatein.org/xml/ns/gatein_resources_1_1";
 
6
CodeRank
This code example shows how to use the following methods:getMessage, getColumnNumber, getLineNumber, getPublicId, getSystemId
     */ 
    private String getPrettyParseExceptionInfo(SAXParseException ex) {
 
        final StringBuilder sb = new StringBuilder();
 
        if (ex.getSystemId() != null) {
            sb.append("systemId=").append(ex.getSystemId()).append(", ");
        } 
        if (ex.getPublicId() != null) {
            sb.append("publicId=").append(ex.getPublicId()).append(", ");
        } 
        if (ex.getLineNumber() > 0) {
            sb.append("Line=").append(ex.getLineNumber());
        } 
        if (ex.getColumnNumber() > 0) {
            sb.append(", Column=").append(ex.getColumnNumber());
        } 
        sb.append(": ").append(ex.getMessage());
 
        return sb.toString();

6
CodeRank
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
   * 
   * @param spe SAXParseException exception. 
   */ 
  public SAXSourceLocator(SAXParseException spe)
  { 
    this.setLineNumber( spe.getLineNumber() );
    this.setColumnNumber( spe.getColumnNumber() );
    this.setPublicId( spe.getPublicId() );
    this.setSystemId( spe.getSystemId() );
  } 
   
  /** 
   * Return the public identifier for the current document event. 
   * 
   * <p>The return value is the public identifier of the document 
   * entity or of the external parsed entity in which the markup 
   * triggering the event appears.</p> 
   * 
   * @return A string containing the public identifier, or 
   *         null if none is available. 
7
CodeRank
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
            } 
 
            mySink.complete();
 
        } catch (SAXParseException e) {
            throw new OsmosisRuntimeException( 
                    "Unable to parse xml" 
                    + ".  publicId=(" + e.getPublicId()
                    + "), systemId=(" + e.getSystemId()
                    + "), lineNumber=" + e.getLineNumber()
                    + ", columnNumber=" + e.getColumnNumber() + ".",
                    e);
        } catch (SAXException e) {
            throw new OsmosisRuntimeException("Unable to parse XML.", e);
        } catch (IOException e) {
            throw new OsmosisRuntimeException("Unable to read XML.", e);
        } finally { 
            mySink.release();
 
            cleanup(); 
7
CodeRank
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
		try { 
			parseMap(inputStream, builder);
			if (builder.nodeRefsWithoutDefsAdded())
				LOG.warning("Nodes were referenced in ways but not defined before.");
		} catch (SAXParseException e) {
			throw new OsmRuntimeException( 
					"Unable to parse input stream" 
					+ ".  publicId=(" + e.getPublicId()
					+ "), systemId=(" + e.getSystemId()
					+ "), lineNumber=" + e.getLineNumber()
					+ ", columnNumber=" + e.getColumnNumber() + ".",
					e);
		} catch (SAXException e) {
			throw new OsmRuntimeException("Unable to parse XML.", e);
		} catch (IOException e) {
			throw new OsmRuntimeException("Unable to read XML input stream.", e);
		} finally { 
			if (inputStream != null) {
				try { 
					inputStream.close();
6
CodeRank
This code example shows how to use the following methods:getLineNumber, getPublicId, getSystemId
        handle(exception,LEVEL_FATAL,"Fatal");
    } 
    private void handle(SAXParseException exception, int level, String levelName) throws SAXExceptionStringBuffer message = new StringBuffer(levelName);
        String fileName = exception.getPublicId();
        if (fileName == null) fileName = exception.getSystemId();
        if (fileName != null) message.append(" at "+fileName);
        message.append(" line "+exception.getLineNumber());
        if (level > maxLevel) maxLevel = level;
        if (level >= minLevel) throw new BadXMLException(message.toString(),exception);
        else  
        { 
            message.append(": "+exception);
            AppD.debug(message+""); 
        } 
         
    } 
    /** 
     * Get the level of the most severe error. 
6
CodeRank
getPublicId Method Overview
Get the public identifier of the entity where the exception occurred.
See Code Examples for other Java 8 SAXParseException Methods: