本文整理匯總了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;
}