uTools-Manuals/docs/java/org/xml/sax/ErrorHandler.html

194 lines
11 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<div class="subTitle">
compact2, compact3
</div>
<div class="subTitle">
org.xml.sax
</div>
<h2 class="title" title="Interface ErrorHandler">Interface ErrorHandler</h2>
</div><div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>
所有已知实现类:
</dt>
<dd>
<span><a href="../../../org/xml/sax/helpers/DefaultHandler.html" title="org.xml.sax.helpers中的类">DefaultHandler</a> <a href="../../../org/xml/sax/ext/DefaultHandler2.html" title="org.xml.sax.ext中的类">DefaultHandler2</a> <a href="../../../org/xml/sax/HandlerBase.html" title="在org.xml.sax中的类">HandlerBase</a> <a href="../../../org/xml/sax/helpers/XMLFilterImpl.html" title="org.xml.sax.helpers中的类">XMLFilterImpl</a></span>
</dd>
</dl>
<hr/> <br/> <pre>public interface <span class="typeNameLabel">ErrorHandler</span></pre>
<div class="block">
<span>SAX错误处理程序的基本界面。</span>
<blockquote>
<span><em>This module, both source code and documentation, is in the Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> See <a href="http://www.saxproject.org">http://www.saxproject.org</a> for further information.</span>
</blockquote>
<p> <span>如果SAX应用程序需要实现自定义的错误处理则必须实现此接口然后使用<a href="../../../org/xml/sax/XMLReader.html#setErrorHandler-org.xml.sax.ErrorHandler-"><code>setErrorHandler</code></a>方法向XML读取器注册一个实例。</span> <span>然后,解析器将通过此界面报告所有错误和警告。</span> </p>
<p> <span><strong>警告:</strong>如果应用程序<em></em>注册ErrorHandlerXML解析错误将不会被报告除非<em>SAXParseException</em>将抛出致命错误。</span> <span>为了检测有效性错误,必须注册一个执行<a href="../../../org/xml/sax/ErrorHandler.html#error-org.xml.sax.SAXParseException-"><code>error()</code></a>调用的ErrorHandler。</span> </p>
<p> <span>对于XML处理错误SAX驱动程序必须使用此接口优先于引发异常由应用程序决定是否针对不同类型的错误和警告抛出异常。</span> <span>但是请注意,无需解析器在调用<a href="../../../org/xml/sax/ErrorHandler.html#fatalError-org.xml.sax.SAXParseException-"><code>fatalError</code></a>后继续报告其他错误。</span> <span>换句话说SAX驱动程序类可能会在报告任何fatalError之后引发异常。</span> <span>解析器也可能为非XML错误抛出适当的异常。</span> <span>例如, <a href="../../../org/xml/sax/XMLReader.html#parse-org.xml.sax.InputSource-"><code>XMLReader.parse()</code></a>将为访问实体或文档的错误抛出IOException。</span> </p>
</div>
<dl>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
SAX 1.0
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<span><a href="../../../org/xml/sax/XMLReader.html#setErrorHandler-org.xml.sax.ErrorHandler-"><code>XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)</code></a> <a href="../../../org/xml/sax/SAXParseException.html" title="在org.xml.sax中的类"><code>SAXParseException</code></a></span>
</dd>
</dl> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- --> </a> <h3>方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Method Summary table, listing methods, and an explanation">
<caption>
<span class="activeTableTab" id="t0"><span>所有方法</span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t2"><span><a href="javascript:show(2);">接口方法</a></span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t3"><span><a href="javascript:show(4);">抽象方法</a></span><span class="tabEnd"> </span></span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor" id="i0">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/xml/sax/ErrorHandler.html#error-org.xml.sax.SAXParseException-">error</a></span>(<a href="../../../org/xml/sax/SAXParseException.html" title="class in org.xml.sax">SAXParseException</a> exception)</code>
<div class="block">
接收可恢复错误的通知。
</div> </td>
</tr>
<tr class="rowColor" id="i1">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/xml/sax/ErrorHandler.html#fatalError-org.xml.sax.SAXParseException-">fatalError</a></span>(<a href="../../../org/xml/sax/SAXParseException.html" title="class in org.xml.sax">SAXParseException</a> exception)</code>
<div class="block">
接收不可恢复错误的通知。
</div> </td>
</tr>
<tr class="altColor" id="i2">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/xml/sax/ErrorHandler.html#warning-org.xml.sax.SAXParseException-">warning</a></span>(<a href="../../../org/xml/sax/SAXParseException.html" title="class in org.xml.sax">SAXParseException</a> exception)</code>
<div class="block">
接收警告通知。
</div> </td>
</tr>
</tbody>
</table> </li>
</ul> </li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- --> </a> <h3>方法详细信息</h3> <a name="warning-org.xml.sax.SAXParseException-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>warning</h4> <pre>void warning(<a href="../../../org/xml/sax/SAXParseException.html" title="class in org.xml.sax">SAXParseException</a> exception)
throws <a href="../../../org/xml/sax/SAXException.html" title="class in org.xml.sax">SAXException</a></pre>
<div class="block">
<span>接收警告通知。</span>
<p> <span>SAX解析器将使用此方法来报告XML推荐定义的不是错误或致命错误的条件。</span> <span>默认行为是不采取任何行动。</span> </p>
<p> <span>调用此方法后SAX解析器必须继续提供正常的解析事件应用程序仍然可以将文档处理到最后。</span> </p>
<p> <span>过滤器也可以使用此方法来报告其他非XML警告。</span> </p>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>exception</code> - 封装在SAX解析异常中的警告信息。
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/xml/sax/SAXException.html" title="class in org.xml.sax">SAXException</a></code> - 任何SAX异常可能包含另一个异常。
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<span><a href="../../../org/xml/sax/SAXParseException.html" title="在org.xml.sax中的类"><code>SAXParseException</code></a></span>
</dd>
</dl> </li>
</ul> <a name="error-org.xml.sax.SAXParseException-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>error</h4> <pre>void error(<a href="../../../org/xml/sax/SAXParseException.html" title="class in org.xml.sax">SAXParseException</a> exception)
throws <a href="../../../org/xml/sax/SAXException.html" title="class in org.xml.sax">SAXException</a></pre>
<div class="block">
<span>接收可恢复错误的通知。</span>
<p> <span>这对应于W3C XML 1.0建议书第1.2节中“错误”的定义。</span> <span>例如,验证解析器将使用此回调来报告违反有效性约束。</span> <span>默认行为是不采取任何行动。</span> </p>
<p> <span>调用此方法后SAX解析器必须继续提供正常的解析事件应用程序仍然可以将文档处理到最后。</span> <span>如果应用程序不能这样做那么解析器应该报告一个致命错误即使XML建议不需要这样做。</span> </p>
<p> <span>过滤器也可以使用此方法来报告其他非XML错误。</span> </p>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>exception</code> - 封装在SAX解析异常中的错误信息。
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/xml/sax/SAXException.html" title="class in org.xml.sax">SAXException</a></code> - 任何SAX异常可能包装另一个异常。
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<span><a href="../../../org/xml/sax/SAXParseException.html" title="在org.xml.sax中的类"><code>SAXParseException</code></a></span>
</dd>
</dl> </li>
</ul> <a name="fatalError-org.xml.sax.SAXParseException-">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>fatalError</h4> <pre>void fatalError(<a href="../../../org/xml/sax/SAXParseException.html" title="class in org.xml.sax">SAXParseException</a> exception)
throws <a href="../../../org/xml/sax/SAXException.html" title="class in org.xml.sax">SAXException</a></pre>
<div class="block">
<span>接收不可恢复错误的通知。</span>
<p> <span><strong>该方法的文档和<code>ContentHandler.endDocument()</code>的文档之间存在明显的<a href="../../../org/xml/sax/ContentHandler.html#endDocument--">矛盾</a></strong></span> <span><strong>在未来的主要版本解决之前客户端不应该假设当解析器报告一个fatalError或抛出异常时是否会调用endDocument</strong></span> </p>
<p> <span>这对应于W3C XML 1.0建议书第1.2节中“致命错误”的定义。</span> <span>例如,解析器将使用此回调来报告违反良好条件约束。</span> </p>
<p> <span>应用程序必须假设在解析器调用此方法后该文档不可用并且应该继续如果有的话仅为了收集其他错误消息实际上SAX解析器可以在此之后自由停止报告任何其他事件方法已被调用。</span> </p>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>exception</code> - 封装在SAX解析异常中的错误信息。
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/xml/sax/SAXException.html" title="class in org.xml.sax">SAXException</a></code> - 任何SAX异常可能包含另一个异常。
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../org/xml/sax/SAXParseException.html" title="class in org.xml.sax"><code>SAXParseException</code></a>
</dd>
</dl> </li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>