本文整理汇总了Java中org.apache.xerces.xni.parser.XMLParseException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java XMLParseException.getMessage方法的具体用法?Java XMLParseException.getMessage怎么用?Java XMLParseException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xni.parser.XMLParseException
的用法示例。
在下文中一共展示了XMLParseException.getMessage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toSAXException
import org.apache.xerces.xni.parser.XMLParseException; //导入方法依赖的package包/类
static SAXException toSAXException(XNIException e) {
if (e instanceof XMLParseException) {
XMLParseException pe = (XMLParseException)e;
return new SAXParseException(pe.getMessage(),
pe.getPublicId(),
pe.getExpandedSystemId(),
pe.getLineNumber(),
pe.getColumnNumber(),
pe.getException());
}
Exception nested = e.getException();
if (nested == null)
return new SAXException(e.getMessage());
if (nested instanceof SAXException)
return (SAXException)nested;
if (nested instanceof RuntimeException)
throw (RuntimeException)nested;
return new SAXException(nested);
}
示例2: warning
import org.apache.xerces.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);
}
}
示例3: error
import org.apache.xerces.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);
}
}
示例4: convertToSAXParseException
import org.apache.xerces.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);
}
示例5: toSAXParseException
import org.apache.xerces.xni.parser.XMLParseException; //导入方法依赖的package包/类
public static SAXParseException toSAXParseException( XMLParseException e ) {
if( e.getException() instanceof SAXParseException )
return (SAXParseException)e.getException();
return new SAXParseException( e.getMessage(),
e.getPublicId(), e.getExpandedSystemId(),
e.getLineNumber(), e.getColumnNumber(),
e.getException() );
}
示例6: createSAXParseException
import org.apache.xerces.xni.parser.XMLParseException; //导入方法依赖的package包/类
/** Creates a SAXParseException from an XMLParseException. */
protected static SAXParseException createSAXParseException(XMLParseException exception) {
return new SAXParseException(exception.getMessage(),
exception.getPublicId(),
exception.getExpandedSystemId(),
exception.getLineNumber(),
exception.getColumnNumber(),
exception.getException());
}
示例7: error
import org.apache.xerces.xni.parser.XMLParseException; //导入方法依赖的package包/类
@Override
public void error(String domain, String key, XMLParseException e) throws XNIException {
// In case the XSD doesn't exist throw an exception to prevent the
// the adapter from starting.
if (e.getMessage() != null
&& e.getMessage().startsWith("schema_reference.4: Failed to read schema document '")) {
throw e;
}
if (warn) {
ConfigurationWarnings.getInstance().add(log, e.getMessage());
}
}
示例8: parse
import org.apache.xerces.xni.parser.XMLParseException; //导入方法依赖的package包/类
/** Parses a document fragment. */
public void parse(InputSource source, DocumentFragment fragment)
throws SAXException, IOException {
fCurrentNode = fDocumentFragment = fragment;
fDocument = fDocumentFragment.getOwnerDocument();
try {
String pubid = source.getPublicId();
String sysid = source.getSystemId();
String encoding = source.getEncoding();
InputStream stream = source.getByteStream();
Reader reader = source.getCharacterStream();
XMLInputSource inputSource =
new XMLInputSource(pubid, sysid, sysid);
inputSource.setEncoding(encoding);
inputSource.setByteStream(stream);
inputSource.setCharacterStream(reader);
fParserConfiguration.parse(inputSource);
}
catch (XMLParseException e) {
Exception ex = e.getException();
if (ex != null) {
throw new SAXParseException(e.getMessage(), null, ex);
}
throw new SAXParseException(e.getMessage(), null);
}
}
示例9: fatalError
import org.apache.xerces.xni.parser.XMLParseException; //导入方法依赖的package包/类
/**
* Report a fatal error. Fatal errors usually occur when the document
* is not well-formed and signifies that the parser cannot continue
* normal operation.
* <p>
* <strong>Note:</strong> The error handler should <em>always</em>
* throw an <code>XNIException</code> from this method. This exception
* can either be the same exception that is passed as a parameter to
* the method or a new XNI exception object. If the registered error
* handler fails to throw an exception, the continuing operation of
* the parser is undetermined.
*
* @param domain The domain of the fatal 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 fatal error.
* @param key The fatal 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 fatalError(String domain, String key,
XMLParseException exception) throws XNIException {
fDOMError.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
fDOMError.fException = exception;
fErrorCode.setValues(domain, key);
String domErrorType = DOMErrorTypeMap.getDOMErrorType(fErrorCode);
fDOMError.fType = (domErrorType != null) ? domErrorType : 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);
}
}
示例10: formatMessage
import org.apache.xerces.xni.parser.XMLParseException; //导入方法依赖的package包/类
private static String formatMessage(XMLParseException ex) {
return "Problem processing schema [" + ex.getLiteralSystemId() + "], on line (" + ex.getLineNumber()
+ "), column (" + ex.getColumnNumber() + ")> " + ex.getMessage();
}