下面列出了org.xml.sax.ErrorHandler#fatalError ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
}
}
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;
}
}
}
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;
}
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}