Java Code Examples for org.xml.sax.ErrorHandler#fatalError()

The following examples show how to use org.xml.sax.ErrorHandler#fatalError() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarshallingSource.java    From spring-analysis-note with MIT License 6 votes vote down vote up
private void parse() throws SAXException {
	SAXResult result = new SAXResult(getContentHandler());
	result.setLexicalHandler(getLexicalHandler());
	try {
		this.marshaller.marshal(this.content, result);
	}
	catch (IOException ex) {
		SAXParseException saxException = new SAXParseException(ex.getMessage(), null, null, -1, -1, ex);
		ErrorHandler errorHandler = getErrorHandler();
		if (errorHandler != null) {
			errorHandler.fatalError(saxException);
		}
		else {
			throw saxException;
		}
	}
}
 
Example 2
Source File: MarshallingSource.java    From java-technology-stack with MIT License 6 votes vote down vote up
private void parse() throws SAXException {
	SAXResult result = new SAXResult(getContentHandler());
	result.setLexicalHandler(getLexicalHandler());
	try {
		this.marshaller.marshal(this.content, result);
	}
	catch (IOException ex) {
		SAXParseException saxException = new SAXParseException(ex.getMessage(), null, null, -1, -1, ex);
		ErrorHandler errorHandler = getErrorHandler();
		if (errorHandler != null) {
			errorHandler.fatalError(saxException);
		}
		else {
			throw saxException;
		}
	}
}
 
Example 3
Source File: MarshallingSource.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
private void parse() throws SAXException {
	SAXResult result = new SAXResult(getContentHandler());
	result.setLexicalHandler(getLexicalHandler());
	try {
		this.marshaller.marshal(this.content, result);
	}
	catch (IOException ex) {
		SAXParseException saxException = new SAXParseException(ex.getMessage(), null, null, -1, -1, ex);
		ErrorHandler errorHandler = getErrorHandler();
		if (errorHandler != null) {
			errorHandler.fatalError(saxException);
		}
		else {
			throw saxException;
		}
	}
}
 
Example 4
Source File: JAXPParser.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void parse( InputSource source, ContentHandler handler,
    ErrorHandler errorHandler, EntityResolver entityResolver )
    
    throws SAXException, IOException {
    
    try {
        XMLReader reader = factory.newSAXParser().getXMLReader();
        reader = new XMLReaderEx(reader);
        
        reader.setContentHandler(handler);
        if(errorHandler!=null)
            reader.setErrorHandler(errorHandler);
        if(entityResolver!=null)
            reader.setEntityResolver(entityResolver);
        reader.parse(source);
    } catch( ParserConfigurationException e ) {
        // in practice this won't happen
        SAXParseException spe = new SAXParseException(e.getMessage(),null,e);
        errorHandler.fatalError(spe);
        throw spe;
    }
}
 
Example 5
Source File: JAXBHeader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
    try {
        bridge.marshal(jaxbObject,contentHandler,null);
    } catch (JAXBException e) {
        SAXParseException x = new SAXParseException(e.getMessage(),null,null,-1,-1,e);
        errorHandler.fatalError(x);
        throw x;
    }
}
 
Example 6
Source File: JAXBHeader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
    try {
        bridge.marshal(jaxbObject,contentHandler,null);
    } catch (JAXBException e) {
        SAXParseException x = new SAXParseException(e.getMessage(),null,null,-1,-1,e);
        errorHandler.fatalError(x);
        throw x;
    }
}
 
Example 7
Source File: JAXBHeader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
    try {
        bridge.marshal(jaxbObject,contentHandler,null);
    } catch (JAXBException e) {
        SAXParseException x = new SAXParseException(e.getMessage(),null,null,-1,-1,e);
        errorHandler.fatalError(x);
        throw x;
    }
}
 
Example 8
Source File: JAXBHeader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
    try {
        bridge.marshal(jaxbObject,contentHandler,null);
    } catch (JAXBException e) {
        SAXParseException x = new SAXParseException(e.getMessage(),null,null,-1,-1,e);
        errorHandler.fatalError(x);
        throw x;
    }
}
 
Example 9
Source File: JAXBHeader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
    try {
        bridge.marshal(jaxbObject,contentHandler,null);
    } catch (JAXBException e) {
        SAXParseException x = new SAXParseException(e.getMessage(),null,null,-1,-1,e);
        errorHandler.fatalError(x);
        throw x;
    }
}
 
Example 10
Source File: JAXBHeader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
    try {
        bridge.marshal(jaxbObject,contentHandler,null);
    } catch (JAXBException e) {
        SAXParseException x = new SAXParseException(e.getMessage(),null,null,-1,-1,e);
        errorHandler.fatalError(x);
        throw x;
    }
}
 
Example 11
Source File: JAXBHeader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
    try {
        bridge.marshal(jaxbObject,contentHandler,null);
    } catch (JAXBException e) {
        SAXParseException x = new SAXParseException(e.getMessage(),null,null,-1,-1,e);
        errorHandler.fatalError(x);
        throw x;
    }
}
 
Example 12
Source File: JAXBHeader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
    try {
        bridge.marshal(jaxbObject,contentHandler,null);
    } catch (JAXBException e) {
        SAXParseException x = new SAXParseException(e.getMessage(),null,null,-1,-1,e);
        errorHandler.fatalError(x);
        throw x;
    }
}