当前位置: 首页>>代码示例>>Java>>正文


Java XMLParseException类代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.xni.parser.XMLParseException的典型用法代码示例。如果您正苦于以下问题:Java XMLParseException类的具体用法?Java XMLParseException怎么用?Java XMLParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XMLParseException类属于com.sun.org.apache.xerces.internal.xni.parser包,在下文中一共展示了XMLParseException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: warning

import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; //导入依赖的package包/类
/**
 * Reports a warning. Warnings are non-fatal and can be safely ignored
 * by most applications.
 *
 * @param domain    The domain of the warning. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this warning.
 * @param key       The warning key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */

public void warning(String domain, String key,
                    XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_WARNING;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode = fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:DOMErrorHandlerWrapper.java

示例2: error

import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; //导入依赖的package包/类
/**
 * Reports an error. Errors are non-fatal and usually signify that the
 * document is invalid with respect to its grammar(s).
 *
 * @param domain    The domain of the error. The domain can be any
 *                  string but is suggested to be a valid URI. The
 *                  domain can be used to conveniently specify a web
 *                  site location of the relevent specification or
 *                  document pertaining to this error.
 * @param key       The error key. This key can be any string and
 *                  is implementation dependent.
 * @param exception Exception.
 *
 * @throws XNIException Thrown to signal that the parser should stop
 *                      parsing the document.
 */
public void error(String domain, String key,
                  XMLParseException exception) throws XNIException {
    fDOMError.fSeverity = DOMError.SEVERITY_ERROR;
    fDOMError.fException = exception;
    // REVISIT: May need to lookup from DOMErrorTypeMap in the future.
    fDOMError.fType = key;
    fDOMError.fRelatedData = fDOMError.fMessage = exception.getMessage();
    DOMLocatorImpl locator = fDOMError.fLocator;
    if (locator != null) {
        locator.fColumnNumber = exception.getColumnNumber();
        locator.fLineNumber = exception.getLineNumber();
        locator.fUtf16Offset = exception.getCharacterOffset();
        locator.fUri = exception.getExpandedSystemId();
        locator.fRelatedNode= fCurrentNode;
    }
    if (fDomErrorHandler != null) {
        fDomErrorHandler.handleError(fDOMError);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:DOMErrorHandlerWrapper.java

示例3: printError

import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; //导入依赖的package包/类
/** Prints the error message. */
private void printError(String type, XMLParseException ex) {

    fOut.print("[");
    fOut.print(type);
    fOut.print("] ");
    String systemId = ex.getExpandedSystemId();
    if (systemId != null) {
        int index = systemId.lastIndexOf('/');
        if (index != -1)
            systemId = systemId.substring(index + 1);
        fOut.print(systemId);
    }
    fOut.print(':');
    fOut.print(ex.getLineNumber());
    fOut.print(':');
    fOut.print(ex.getColumnNumber());
    fOut.print(": ");
    fOut.print(ex.getMessage());
    fOut.println();
    fOut.flush();

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:DefaultErrorHandler.java

示例4: createXMLParseException

import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; //导入依赖的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

示例5: convertToSAXParseException

import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; //导入依赖的package包/类
static void convertToSAXParseException(XMLParseException e) throws SAXException {
    Exception ex = e.getException();
    if (ex == null) {
        // must be a parser exception; mine it for locator info and throw
        // a SAXParseException
        LocatorImpl locatorImpl = new LocatorImpl();
        locatorImpl.setPublicId(e.getPublicId());
        locatorImpl.setSystemId(e.getExpandedSystemId());
        locatorImpl.setLineNumber(e.getLineNumber());
        locatorImpl.setColumnNumber(e.getColumnNumber());
        throw new SAXParseException(e.getMessage(), locatorImpl);
    }
    if (ex instanceof SAXException) {
        // why did we create an XMLParseException?
        throw (SAXException) ex;
    }
    throw new SAXException(ex);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:SchemaContentHandler.java

示例6: parseDate

import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; //导入依赖的package包/类
private static Date parseDate(String text) throws Exception {
    Date date = parseDateWithFormat(datePattern1, text);
    if (date != null) {
        return date;
    } else {
        date = parseDateWithFormat(datePattern2, text);
        if (date != null) {
            return date;
        } else {
            date = parseDateWithFormat(datePattern3, text);
            if (date != null) {
                return date;
            } else {
                throw new XMLParseException(null, "Illegal date format");
            }
        }
    }
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:19,代码来源:XMLParser.java


注:本文中的com.sun.org.apache.xerces.internal.xni.parser.XMLParseException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。