本文整理汇总了Java中javax.xml.stream.XMLStreamException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java XMLStreamException.getMessage方法的具体用法?Java XMLStreamException.getMessage怎么用?Java XMLStreamException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.stream.XMLStreamException
的用法示例。
在下文中一共展示了XMLStreamException.getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readStAXSource
import javax.xml.stream.XMLStreamException; //导入方法依赖的package包/类
private Source readStAXSource(InputStream body) {
try {
XMLInputFactory inputFactory = XMLInputFactory.newFactory();
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, isProcessExternalEntities());
if (!isProcessExternalEntities()) {
inputFactory.setXMLResolver(NO_OP_XML_RESOLVER);
}
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(body);
return new StAXSource(streamReader);
}
catch (XMLStreamException ex) {
throw new HttpMessageNotReadableException("Could not parse document: " + ex.getMessage(), ex);
}
}
示例2: dispose
import javax.xml.stream.XMLStreamException; //导入方法依赖的package包/类
@Override
public void dispose() {
try {
responseWriter.writeEndElement();
responseWriter.writeCharacters(EOL);
responseWriter.writeEndElement();
responseWriter.writeCharacters(EOL);
responseWriter.writeEndDocument();
responseWriter.writeCharacters(EOL);
responseWriter.flush();
responseWriter.close();
System.out.println("Gaze responses saved.");
} catch (XMLStreamException e) {
throw new RuntimeException("Log file footer could not be written: "
+ e.getMessage());
}
outFile = null;
}
示例3: parse
import javax.xml.stream.XMLStreamException; //导入方法依赖的package包/类
public void parse() throws SAXException {
// parses from a StAX reader and generates SAX events which
// go through the repeater and are forwarded to the appropriate
// component
try {
reader.bridge();
} catch( XMLStreamException e ) {
// wrap it in a SAXException
SAXParseException se =
new SAXParseException2(
e.getMessage(),
null,
null,
e.getLocation() == null ? -1 : e.getLocation().getLineNumber(),
e.getLocation() == null ? -1 : e.getLocation().getColumnNumber(),
e);
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
} finally {
try {
staxReader.close();
} catch(XMLStreamException xe) {
//falls through. Not much can be done.
}
}
}
示例4: next
import javax.xml.stream.XMLStreamException; //导入方法依赖的package包/类
public Object next() {
Object object = null;
try{
object = nextEvent();
}catch(XMLStreamException streamException){
fLastEvent = null ;
//don't swallow the cause
NoSuchElementException e = new NoSuchElementException(streamException.getMessage());
e.initCause(streamException.getCause());
throw e;
}
return object;
}