當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLStreamException.getMessage方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:SourceHttpMessageConverter.java

示例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;
}
 
開發者ID:SERESLab,項目名稱:iTrace-Archive,代碼行數:19,代碼來源:XMLGazeExportSolver.java

示例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.
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:35,代碼來源:StAXSource.java

示例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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:15,代碼來源:XMLEventReaderImpl.java


注:本文中的javax.xml.stream.XMLStreamException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。