當前位置: 首頁>>代碼示例>>Java>>正文


Java SAXParseException.getPublicId方法代碼示例

本文整理匯總了Java中org.xml.sax.SAXParseException.getPublicId方法的典型用法代碼示例。如果您正苦於以下問題:Java SAXParseException.getPublicId方法的具體用法?Java SAXParseException.getPublicId怎麽用?Java SAXParseException.getPublicId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.xml.sax.SAXParseException的用法示例。


在下文中一共展示了SAXParseException.getPublicId方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DefaultXMLProcessorDetail

import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/**
 * Create new DefaultXMLProcessorMessage based on SAXParseException.
 * @param spex SAX exception to be wrapped (never <code>null</code>).
 */
public DefaultXMLProcessorDetail(SAXParseException spex) {
    if (spex == null) throw new NullPointerException();

    this.exception = spex;
    this.columnNumber = spex.getColumnNumber();
    this.lineNumber = spex.getLineNumber();
    this.publicId = spex.getPublicId();
    this.systemId = spex.getSystemId();

    if ( Util.THIS.isLoggable() ) /* then */ {
        Util.THIS.debug ("DefaultXMLProcessorDetail: SAXParseException");
        Util.THIS.debug ("    exception= " + exception);
        Util.THIS.debug ("    columnNumber= " + columnNumber);
        Util.THIS.debug ("    lineNumber= " + lineNumber);
        Util.THIS.debug ("    publicId= " + publicId);
        Util.THIS.debug ("    systemId= " + systemId);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:DefaultXMLProcessorDetail.java

示例2: createXMLParseException

import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/** Creates an XMLParseException from a SAXParseException. */
protected static XMLParseException createXMLParseException(SAXParseException exception) {
    final String fPublicId = exception.getPublicId();
    final String fExpandedSystemId = exception.getSystemId();
    final int fLineNumber = exception.getLineNumber();
    final int fColumnNumber = exception.getColumnNumber();
    XMLLocator location = new XMLLocator() {
        public String getPublicId() { return fPublicId; }
        public String getExpandedSystemId() { return fExpandedSystemId; }
        public String getBaseSystemId() { return null; }
        public String getLiteralSystemId() { return null; }
        public int getColumnNumber() { return fColumnNumber; }
        public int getLineNumber() { return fLineNumber; }
        public int getCharacterOffset() { return -1; }
        public String getEncoding() { return null; }
        public String getXMLVersion() { return null; }
    };
    return new XMLParseException(location, exception.getMessage(),exception);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:ErrorHandlerWrapper.java

示例3: error

import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
public void error(SAXParseException e) {
    if(debug)
        e.printStackTrace();
    hasError = true;
    if((e.getSystemId() == null && e.getPublicId() == null) && (e.getCause() instanceof UnknownHostException)) {
        print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.toString()), e);
    } else {
        print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:11,代碼來源:ConsoleErrorReporter.java

示例4: getMessage

import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/**
 * @param ex The exception to create a message from
 * @return A summary of what went wrong.
 */
private String getMessage(SAXParseException ex)
{
    if (ex.getSystemId() != null)
    {
        return "SystemID=" + ex.getSystemId() + " Line=" + ex.getLineNumber() + ' ' + ex.getMessage();
    }

    if (ex.getPublicId() != null)
    {
        return "PublicID=" + ex.getPublicId() + " Line=" + ex.getLineNumber() + ' ' + ex.getMessage();
    }

    return "Line=" + ex.getLineNumber() + ' ' + ex.getMessage();
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:19,代碼來源:LogErrorHandler.java

示例5: tryWrappedLocator

import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
private void tryWrappedLocator(Exception ex) {
    if ( Util.THIS.isLoggable() ) /* then */ {
        Util.THIS.debug ("DefaultXMLProcessorDetail.tryWrappedLocator: " + ex);
    }

    // I saw SAXException wrapped in TransformerException and vice versa

    Throwable wrapped = null;
    if (ex instanceof TransformerException) {
        wrapped = ((TransformerException) ex).getException();
    } else if (ex instanceof SAXException) {
        wrapped = ((SAXException) ex).getException();
    } else {
        return;
    }

    // look if wrapped exception does not provide location info

    if (wrapped instanceof SAXParseException) {
        SAXParseException pex = (SAXParseException) wrapped;
        if (pex.getLineNumber() == -1) {
            tryWrappedLocator(pex);
        } else {
            this.columnNumber = pex.getColumnNumber();
            this.lineNumber = pex.getLineNumber();
            this.publicId = pex.getPublicId();
            this.systemId = pex.getSystemId();                    
        }
    } else if (wrapped instanceof TransformerException) {
        TransformerException wrappedTransformerEx = 
            (TransformerException) wrapped;
        SourceLocator locator = wrappedTransformerEx.getLocator();
        if (locator == null) {
            tryWrappedLocator(wrappedTransformerEx);
        } else {
            if (locator.getLineNumber() == -1) {
                tryWrappedLocator(wrappedTransformerEx);
            } else {
                this.columnNumber = locator.getColumnNumber();
                this.lineNumber = locator.getLineNumber();
                this.publicId = locator.getPublicId();
                this.systemId = locator.getSystemId();                        
            }
        }
    } else if (wrapped instanceof SAXException) {
        tryWrappedLocator((SAXException)wrapped);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:49,代碼來源:DefaultXMLProcessorDetail.java


注:本文中的org.xml.sax.SAXParseException.getPublicId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。