本文整理了Java中org.xml.sax.Parser.setErrorHandler()
方法的一些代码示例,展示了Parser.setErrorHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.setErrorHandler()
方法的具体详情如下:
包路径:org.xml.sax.Parser
类名称:Parser
方法名:setErrorHandler
[英]Allow an application to register an error event handler.
If the application does not register an error event handler, all error events reported by the SAX parser will be silently ignored, except for fatalError, which will throw a SAXException (this is the default behaviour implemented by HandlerBase).
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
[中]允许应用程序注册错误事件处理程序。
如果应用程序未注册错误事件处理程序,SAX解析器报告的所有错误事件都将被静默忽略,fatalError除外,fatalError将引发SAXException(这是HandlerBase实现的默认行为)。
应用程序可以在解析过程中登记新的或不同的处理程序,SAX解析器必须立即使用新的处理程序。
代码示例来源:origin: org.apache.ant/ant
parser.setDocumentHandler(hb);
parser.setEntityResolver(hb);
parser.setErrorHandler(hb);
parser.setDTDHandler(hb);
parser.parse(inputSource);
代码示例来源:origin: robovm/robovm
/**
* Initialize the parser before each run.
*/
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
throw new IllegalStateException ();
nsSupport.reset();
if (uris)
nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}
代码示例来源:origin: robovm/robovm
parser.setDocumentHandler(hb);
parser.setEntityResolver(hb);
parser.setErrorHandler(hb);
parser.setDTDHandler(hb);
代码示例来源:origin: xml-resolver/xml-resolver
/** SAX Parser API. */
public void setErrorHandler(ErrorHandler handler) {
parser.setErrorHandler(handler);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver
/** SAX Parser API. */
public void setErrorHandler(ErrorHandler handler) {
parser.setErrorHandler(handler);
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/** SAX Parser API. */
public void setErrorHandler(ErrorHandler handler) {
parser.setErrorHandler(handler);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/** SAX Parser API. */
public void setErrorHandler(ErrorHandler handler) {
parser.setErrorHandler(handler);
}
代码示例来源:origin: sun-jaxb/jaxb-xjc
/** SAX Parser API. */
public void setErrorHandler(ErrorHandler handler) {
parser.setErrorHandler(handler);
}
代码示例来源:origin: org.apache.xml/com.springsource.org.apache.xml.resolver
/** SAX Parser API. */
public void setErrorHandler(ErrorHandler handler) {
parser.setErrorHandler(handler);
}
代码示例来源:origin: com.sun.org.apache.xml.internal/resolver
/** SAX Parser API. */
public void setErrorHandler(ErrorHandler handler) {
parser.setErrorHandler(handler);
}
代码示例来源:origin: org.w3c.jigsaw/jigsaw
protected void parse()
throws SAXException, IOException
{
parser.setDocumentHandler(this);
parser.setErrorHandler(this);
parser.parse(new InputSource(reader));
}
代码示例来源:origin: org.w3c.jigsaw/jigsaw
protected void parse()
throws SAXException, IOException
{
try {
parser.setDocumentHandler(this);
parser.setErrorHandler(this);
parser.parse(new InputSource(reader));
} catch (IOException ex) {
try { reader.close(); } catch (IOException ioex) {}
throw ex;
} catch (SAXException sex) {
try { reader.close(); } catch (IOException ioex) {}
throw sex;
}
}
代码示例来源:origin: org.w3c.jigsaw/jigsaw
protected void parse()
throws SAXException, IOException
{
try {
parser.setDocumentHandler(this);
parser.setErrorHandler(this);
parser.parse(new InputSource(reader));
// } catch (IOException ex) {
// try { reader.close(); } catch (IOException ioex) {}
// throw ex;
// } catch (SAXException sex) {
// try { reader.close(); } catch (IOException ioex) {}
// throw sex;
} finally {
try { reader.close(); } catch (IOException ioex) {}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
private Parser getParser(boolean validate) throws SAXException, ParserConfigurationException, FactoryConfigurationError {
Parser parser;
parser = new XMLReaderAdapter (XMLUtil.createXMLReader(validate));
// create document handler and register it
//parser.setEntityResolver(entityRes);
parser.setEntityResolver(this);
parser.setDocumentHandler(this);//before new InnerParser() - now this
parser.setErrorHandler(this);
return parser;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
private Parser getParser(boolean validate) throws SAXException, ParserConfigurationException, FactoryConfigurationError {
Parser parser;
parser = new XMLReaderAdapter (XMLUtil.createXMLReader(validate));
// create document handler and register it
//parser.setEntityResolver(entityRes);
parser.setEntityResolver(this);
parser.setDocumentHandler(this);//before new InnerParser() - now this
parser.setErrorHandler(this);
return parser;
}
代码示例来源:origin: org.codehaus.castor/castor-xml-schema
protected void parseSchema(Parser parser, SchemaUnmarshaller schemaUnmarshaller, URILocation uri,
String schemaLocation, String reason) throws SchemaException {
Sax2ComponentReader handler = new Sax2ComponentReader(schemaUnmarshaller);
parser.setDocumentHandler(handler);
parser.setErrorHandler(handler);
try {
InputSource source = new InputSource(uri.getReader());
source.setSystemId(uri.getAbsoluteURI());
parser.parse(source);
} catch (java.io.IOException ioe) {
throw new SchemaException("Error reading " + reason + " file '" + schemaLocation + "'");
} catch (org.xml.sax.SAXException sx) {
throw new SchemaException(sx);
}
}
代码示例来源:origin: ibinti/bugvm
/**
* Initialize the parser before each run.
*/
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
throw new IllegalStateException ();
nsSupport.reset();
if (uris)
nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}
代码示例来源:origin: MobiVM/robovm
/**
* Initialize the parser before each run.
*/
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
throw new IllegalStateException ();
nsSupport.reset();
if (uris)
nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Initialize the parser before each run.
*/
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
throw new IllegalStateException ();
nsSupport.reset();
if (uris)
nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Initialize the parser before each run.
*/
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
throw new IllegalStateException ();
nsSupport.reset();
if (uris)
nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}
内容来源于网络,如有侵权,请联系作者删除!