本文整理汇总了Java中org.apache.xerces.xni.parser.XMLParseException.getException方法的典型用法代码示例。如果您正苦于以下问题:Java XMLParseException.getException方法的具体用法?Java XMLParseException.getException怎么用?Java XMLParseException.getException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xni.parser.XMLParseException
的用法示例。
在下文中一共展示了XMLParseException.getException方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: 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() );
}
示例4: 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());
}
示例5: 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);
}
}