mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-17 13:06:58 +08:00
323 lines
16 KiB
HTML
323 lines
16 KiB
HTML
<div class="header">
|
||
<h1 class="title" title="Package">Package org.xml.sax</h1>
|
||
<div class="docSummary">
|
||
<div class="block">
|
||
该软件包提供核心SAX API。
|
||
</div>
|
||
</div>
|
||
<p>See: <a href="#package.description">描述</a></p>
|
||
</div><div class="contentContainer">
|
||
<ul class="blockList">
|
||
<li class="blockList">
|
||
<table border="0" cellpadding="3" cellspacing="0" class="typeSummary" summary="Interface Summary table, listing interfaces, and an explanation">
|
||
<caption>
|
||
<span>接口摘要</span>
|
||
<span class="tabEnd"> </span>
|
||
</caption>
|
||
<tbody>
|
||
<tr>
|
||
<th class="colFirst" scope="col">接口</th>
|
||
<th class="colLast" scope="col">描述</th>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/AttributeList.html" title="interface in org.xml.sax">AttributeList</a></td>
|
||
<td class="colLast">Deprecated
|
||
<div class="block">
|
||
<span><span class="deprecationComment">该接口已被SAX2 <a href="../../../org/xml/sax/Attributes.html" title="org.xml.sax中的接口"><code>Attributes</code></a>接口所取代,其中包括Namespace支持。</span></span>
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/Attributes.html" title="interface in org.xml.sax">Attributes</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
XML属性列表的接口。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/ContentHandler.html" title="interface in org.xml.sax">ContentHandler</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
接收文档逻辑内容的通知。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/DocumentHandler.html" title="interface in org.xml.sax">DocumentHandler</a></td>
|
||
<td class="colLast">Deprecated
|
||
<div class="block">
|
||
<span><span class="deprecationComment">该接口已被SAX2 <a href="../../../org/xml/sax/ContentHandler.html" title="org.xml.sax中的接口"><code>ContentHandler</code></a>接口所替代,其中包括命名空间支持。</span></span>
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/DTDHandler.html" title="interface in org.xml.sax">DTDHandler</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
接收基本DTD相关事件的通知。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/EntityResolver.html" title="interface in org.xml.sax">EntityResolver</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
解决实体的基本界面。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/ErrorHandler.html" title="interface in org.xml.sax">ErrorHandler</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
SAX错误处理程序的基本界面。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/Locator.html" title="interface in org.xml.sax">Locator</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
用于将SAX事件与文档位置相关联的界面。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/Parser.html" title="interface in org.xml.sax">Parser</a></td>
|
||
<td class="colLast">Deprecated
|
||
<div class="block">
|
||
<span><span class="deprecationComment">该接口已被SAX2 <a href="../../../org/xml/sax/XMLReader.html" title="org.xml.sax中的接口"><code>XMLReader</code></a>接口所取代,其中包括命名空间支持。</span></span>
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/XMLFilter.html" title="interface in org.xml.sax">XMLFilter</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
XML过滤器的接口。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/XMLReader.html" title="interface in org.xml.sax">XMLReader</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
使用回调读取XML文档的界面。
|
||
</div> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table> </li>
|
||
<li class="blockList">
|
||
<table border="0" cellpadding="3" cellspacing="0" class="typeSummary" summary="Class Summary table, listing classes, and an explanation">
|
||
<caption>
|
||
<span>类摘要</span>
|
||
<span class="tabEnd"> </span>
|
||
</caption>
|
||
<tbody>
|
||
<tr>
|
||
<th class="colFirst" scope="col">类</th>
|
||
<th class="colLast" scope="col">描述</th>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/HandlerBase.html" title="class in org.xml.sax">HandlerBase</a></td>
|
||
<td class="colLast">Deprecated
|
||
<div class="block">
|
||
<span><span class="deprecationComment">此类与已弃用的<a href="../../../org/xml/sax/DocumentHandler.html" title="org.xml.sax中的接口"><code>DocumentHandler</code></a>接口配合使用。</span></span>
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/InputSource.html" title="class in org.xml.sax">InputSource</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
XML实体的单一输入源。
|
||
</div> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table> </li>
|
||
<li class="blockList">
|
||
<table border="0" cellpadding="3" cellspacing="0" class="typeSummary" summary="Exception Summary table, listing exceptions, and an explanation">
|
||
<caption>
|
||
<span>异常摘要</span>
|
||
<span class="tabEnd"> </span>
|
||
</caption>
|
||
<tbody>
|
||
<tr>
|
||
<th class="colFirst" scope="col">异常</th>
|
||
<th class="colLast" scope="col">描述</th>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/SAXException.html" title="class in org.xml.sax">SAXException</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
封装一般的SAX错误或警告。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/SAXNotRecognizedException.html" title="class in org.xml.sax">SAXNotRecognizedException</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
无法识别的标识符的异常类。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/SAXNotSupportedException.html" title="class in org.xml.sax">SAXNotSupportedException</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
不受支持的操作的异常类。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../org/xml/sax/SAXParseException.html" title="class in org.xml.sax">SAXParseException</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
封装XML解析错误或警告。
|
||
</div> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table> </li>
|
||
</ul>
|
||
<a name="package.description">
|
||
<!-- --> </a>
|
||
<h2 title="Package org.xml.sax Description">Package org.xml.sax Description</h2>
|
||
<div class="block">
|
||
<p> This package provides the core SAX APIs. Some SAX1 APIs are deprecated to encourage integration of namespace-awareness into designs of new applications and into maintenance of existing infrastructure. </p>
|
||
<p>See <a href="http://www.saxproject.org" target="_top">http://www.saxproject.org</a> for more information about SAX.</p>
|
||
<h2> SAX2 Standard Feature Flags </h2>
|
||
<p> One of the essential characteristics of SAX2 is that it added feature flags which can be used to examine and perhaps modify parser modes, in particular modes such as validation. Since features are identified by (absolute) URIs, anyone can define such features. Currently defined standard feature URIs have the prefix <code>http://xml.org/sax/features/</code> before an identifier such as <code>validation</code>. Turn features on or off using <em>setFeature</em>. Those standard identifiers are: </p>
|
||
<table border="1" cellpadding="3" cellspacing="0" width="100%">
|
||
<tbody>
|
||
<tr align="center" bgcolor="#ccccff">
|
||
<th>Feature ID</th>
|
||
<th>Access</th>
|
||
<th>Default</th>
|
||
<th>描述</th>
|
||
</tr>
|
||
<tr>
|
||
<td>external-general-entities</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>unspecified</em></td>
|
||
<td> Reports whether this parser processes external general entities; always true if validating. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>external-parameter-entities</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>unspecified</em></td>
|
||
<td> Reports whether this parser processes external parameter entities; always true if validating. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>is-standalone</td>
|
||
<td>(parsing) <em>read-only</em>, (not parsing) <em>none</em></td>
|
||
<td>not applicable</td>
|
||
<td> May be examined only during a parse, after the <em>startDocument()</em> callback has been completed; read-only. The value is true if the document specified standalone="yes" in its XML declaration, and otherwise is false. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>lexical-handler/parameter-entities</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>unspecified</em></td>
|
||
<td> A value of "true" indicates that the LexicalHandler will report the beginning and end of parameter entities. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>namespaces</td>
|
||
<td><em>read/write</em></td>
|
||
<td>true</td>
|
||
<td> A value of "true" indicates namespace URIs and unprefixed local names for element and attribute names will be available. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>namespace-prefixes</td>
|
||
<td><em>read/write</em></td>
|
||
<td>false</td>
|
||
<td> A value of "true" indicates that XML qualified names (with prefixes) and attributes (including <em>xmlns*</em> attributes) will be available. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>resolve-dtd-uris</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>true</em></td>
|
||
<td> A value of "true" indicates that system IDs in declarations will be absolutized (relative to their base URIs) before reporting. (That is the default behavior for all SAX2 XML parsers.) A value of "false" indicates those IDs will not be absolutized; parsers will provide the base URI from <em>Locator.getSystemId()</em>. This applies to system IDs passed in
|
||
<ul>
|
||
<li><em>DTDHandler.notationDecl()</em>, </li>
|
||
<li><em>DTDHandler.unparsedEntityDecl()</em>, and </li>
|
||
<li><em>DeclHandler.externalEntityDecl()</em>. </li>
|
||
</ul> It does not apply to <em>EntityResolver.resolveEntity()</em>, which is not used to report declarations, or to <em>LexicalHandler.startDTD()</em>, which already provides the non-absolutized URI. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>string-interning</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>unspecified</em></td>
|
||
<td> Has a value of "true" if all XML names (for elements, prefixes, attributes, entities, notations, and local names), as well as Namespace URIs, will have been interned using <em>java.lang.String.intern</em>. This supports fast testing of equality/inequality against string constants, rather than forcing slower calls to <em>String.equals()</em>. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>unicode-normalization-checking</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>false</em></td>
|
||
<td> Controls whether the parser reports Unicode normalization errors as described in section 2.13 and Appendix B of the XML 1.1 Recommendation. If true, Unicode normalization errors are reported using the ErrorHandler.error() callback. Such errors are not fatal in themselves (though, obviously, other Unicode-related encoding errors may be). </td>
|
||
</tr>
|
||
<tr>
|
||
<td>use-attributes2</td>
|
||
<td><em>read-only</em></td>
|
||
<td>not applicable</td>
|
||
<td> Returns "true" if the <em>Attributes</em> objects passed by this parser in <em>ContentHandler.startElement()</em> implement the <a href="ext/Attributes2.html"><em>org.xml.sax.ext.Attributes2</em></a> interface. That interface exposes additional DTD-related information, such as whether the attribute was specified in the source text rather than defaulted. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>use-locator2</td>
|
||
<td><em>read-only</em></td>
|
||
<td>not applicable</td>
|
||
<td> Returns "true" if the <em>Locator</em> objects passed by this parser in <em>ContentHandler.setDocumentLocator()</em> implement the <a href="ext/Locator2.html"><em>org.xml.sax.ext.Locator2</em></a> interface. That interface exposes additional entity information, such as the character encoding and XML version used. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>use-entity-resolver2</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>true</em></td>
|
||
<td> Returns "true" if, when <em>setEntityResolver</em> is given an object implementing the <a href="ext/EntityResolver2.html"><em>org.xml.sax.ext.EntityResolver2</em></a> interface, those new methods will be used. Returns "false" to indicate that those methods will not be used. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>validation</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>unspecified</em></td>
|
||
<td> Controls whether the parser is reporting all validity errors; if true, all external entities will be read. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>xmlns-uris</td>
|
||
<td><em>read/write</em></td>
|
||
<td><em>false</em></td>
|
||
<td> Controls whether, when the <em>namespace-prefixes</em> feature is set, the parser treats namespace declaration attributes as being in the <em>http://www.w3.org/2000/xmlns/</em> namespace. By default, SAX2 conforms to the original "Namespaces in XML" Recommendation, which explicitly states that such attributes are not in any namespace. Setting this optional flag to "true" makes the SAX2 events conform to a later backwards-incompatible revision of that recommendation, placing those attributes in a namespace. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>xml-1.1</td>
|
||
<td><em>read-only</em></td>
|
||
<td>not applicable</td>
|
||
<td> Returns "true" if the parser supports both XML 1.1 and XML 1.0. Returns "false" if the parser supports only XML 1.0. </td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p> Support for the default values of the <em>namespaces</em> and <em>namespace-prefixes</em> properties is required. Support for any other feature flags is entirely optional. </p>
|
||
<p> For default values not specified by SAX2, each XMLReader implementation specifies its default, or may choose not to expose the feature flag. Unless otherwise specified here, implementations may support changing current values of these standard feature flags, but not while parsing. </p>
|
||
<h2> SAX2 Standard Handler and Property IDs </h2>
|
||
<p> For parser interface characteristics that are described as objects, a separate namespace is defined. The objects in this namespace are again identified by URI, and the standard property URIs have the prefix <code>http://xml.org/sax/properties/</code> before an identifier such as <code>lexical-handler</code> or <code>dom-node</code>. Manage those properties using <em>setProperty()</em>. Those identifiers are: </p>
|
||
<table border="1" cellpadding="3" cellspacing="0" width="100%">
|
||
<tbody>
|
||
<tr align="center" bgcolor="#ccccff">
|
||
<th>Property ID</th>
|
||
<th>描述</th>
|
||
</tr>
|
||
<tr>
|
||
<td>declaration-handler</td>
|
||
<td> Used to see most DTD declarations except those treated as lexical ("document element name is ...") or which are mandatory for all SAX parsers (<em>DTDHandler</em>). The Object must implement <a href="ext/DeclHandler.html"><em>org.xml.sax.ext.DeclHandler</em></a>. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>document-xml-version</td>
|
||
<td> May be examined only during a parse, after the startDocument() callback has been completed; read-only. This property is a literal string describing the actual XML version of the document, such as "1.0" or "1.1". </td>
|
||
</tr>
|
||
<tr>
|
||
<td>dom-node</td>
|
||
<td> For "DOM Walker" style parsers, which ignore their <em>parser.parse()</em> parameters, this is used to specify the DOM (sub)tree being walked by the parser. The Object must implement the <em>org.w3c.dom.Node</em> interface. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>lexical-handler</td>
|
||
<td> Used to see some syntax events that are essential in some applications: comments, CDATA delimiters, selected general entity inclusions, and the start and end of the DTD (and declaration of document element name). The Object must implement <a href="ext/LexicalHandler.html"><em>org.xml.sax.ext.LexicalHandler</em></a>. </td>
|
||
</tr>
|
||
<tr>
|
||
<td>xml-string</td>
|
||
<td> Readable only during a parser callback, this exposes a <b>TBS</b> chunk of characters responsible for the current event. </td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p> All of these standard properties are optional; XMLReader implementations need not support them. </p>
|
||
</div>
|
||
</div> |