mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-07-06 00:32:44 +08:00
90 lines
9.3 KiB
HTML
90 lines
9.3 KiB
HTML
<div class="header">
|
||
<h1 class="title" title="Package">Package javax.xml.transform.sax</h1>
|
||
<div class="docSummary">
|
||
<div class="block">
|
||
该软件包实现了特定于SAX2的转换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="../../../../javax/xml/transform/sax/TemplatesHandler.html" title="interface in javax.xml.transform.sax">TemplatesHandler</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
可用于将SAX解析事件(解析变换指令)转换为“模板”对象的SAX ContentHandler。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../../javax/xml/transform/sax/TransformerHandler.html" title="interface in javax.xml.transform.sax">TransformerHandler</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
TransformerHandler侦听SAX ContentHandler解析事件并将其转换为Result。
|
||
</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="../../../../javax/xml/transform/sax/SAXResult.html" title="class in javax.xml.transform.sax">SAXResult</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
作为转型结果的持有人。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../../javax/xml/transform/sax/SAXSource.html" title="class in javax.xml.transform.sax">SAXSource</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
作为SAX风格来源的持有人。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../../javax/xml/transform/sax/SAXTransformerFactory.html" title="class in javax.xml.transform.sax">SAXTransformerFactory</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
此类扩展TransformerFactory以提供SAX特定的工厂方法。
|
||
</div> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table> </li>
|
||
</ul>
|
||
<a name="package.description">
|
||
<!-- --> </a>
|
||
<h2 title="Package javax.xml.transform.sax Description">Package javax.xml.transform.sax Description</h2>
|
||
<div class="block">
|
||
<p>This package implements SAX2-specific transformation APIs. It provides classes which allow input from <a href="../../../../org/xml/sax/ContentHandler.html" title="interface in org.xml.sax"><code>ContentHandler</code></a> events, and also classes that produce org.xml.sax.ContentHandler events. It also provides methods to set the input source as an <a href="../../../../org/xml/sax/XMLReader.html" title="interface in org.xml.sax"><code>XMLReader</code></a>, or to use a <a href="../../../../org/xml/sax/InputSource.html" title="class in org.xml.sax"><code>InputSource</code></a> as the source. It also allows the creation of a <a href="../../../../org/xml/sax/XMLFilter.html" title="interface in org.xml.sax"><code>XMLFilter</code></a>, which enables transformations to "pull" from other transformations, and lets the transformer to be used polymorphically as an <a href="../../../../org/xml/sax/XMLReader.html" title="interface in org.xml.sax"><code>XMLReader</code></a>.</p>
|
||
<p>The <a href="../../../../javax/xml/transform/sax/SAXSource.html" title="class in javax.xml.transform.sax"><code>SAXSource</code></a> class allows the setting of an <a href="../../../../org/xml/sax/XMLReader.html" title="interface in org.xml.sax"><code>XMLReader</code></a> to be used for "pulling" parse events, and an <a href="../../../../org/xml/sax/InputSource.html" title="class in org.xml.sax"><code>InputSource</code></a> that may be used to specify the SAX source.</p>
|
||
<p>The <a href="../../../../javax/xml/transform/sax/SAXResult.html" title="class in javax.xml.transform.sax"><code>SAXResult</code></a> class allows the setting of a <a href="../../../../org/xml/sax/ContentHandler.html" title="interface in org.xml.sax"><code>ContentHandler</code></a> to be the receiver of SAX2 events from the transformation. </p>
|
||
<p>The <a href="../../../../javax/xml/transform/sax/SAXTransformerFactory.html" title="class in javax.xml.transform.sax"><code>SAXTransformerFactory</code></a> extends <a href="../../../../javax/xml/transform/TransformerFactory.html" title="class in javax.xml.transform"><code>TransformerFactory</code></a> to provide factory methods for creating <a href="../../../../javax/xml/transform/sax/TemplatesHandler.html" title="interface in javax.xml.transform.sax"><code>TemplatesHandler</code></a>, <a href="../../../../javax/xml/transform/sax/TransformerHandler.html" title="interface in javax.xml.transform.sax"><code>TransformerHandler</code></a>, and <a href="../../../../org/xml/sax/XMLReader.html" title="interface in org.xml.sax"><code>XMLReader</code></a> instances.</p>
|
||
<p>To obtain a <a href="../../../../javax/xml/transform/sax/SAXTransformerFactory.html" title="class in javax.xml.transform.sax"><code>SAXTransformerFactory</code></a>, the caller must cast the <a href="../../../../javax/xml/transform/TransformerFactory.html" title="class in javax.xml.transform"><code>TransformerFactory</code></a> instance returned from <a href="../../../../javax/xml/transform/TransformerFactory.html#newInstance--"><code>TransformerFactory.newInstance()</code></a>. </p>
|
||
<p>The <a href="../../../../javax/xml/transform/sax/TransformerHandler.html" title="interface in javax.xml.transform.sax"><code>TransformerHandler</code></a> interface allows a transformation to be created from SAX2 parse events, which is a "push" model rather than the "pull" model that normally occurs for a transformation. Normal parse events are received through the <a href="../../../../org/xml/sax/ContentHandler.html" title="interface in org.xml.sax"><code>ContentHandler</code></a> interface, lexical events such as startCDATA and endCDATA are received through the <a href="../../../../org/xml/sax/ext/LexicalHandler.html" title="interface in org.xml.sax.ext"><code>LexicalHandler</code></a> interface, and events that signal the start or end of disabling output escaping are received via <a href="../../../../org/xml/sax/ContentHandler.html#processingInstruction-java.lang.String-java.lang.String-"><code>ContentHandler.processingInstruction(java.lang.String, java.lang.String)</code></a>, with the target parameter being <a href="../../../../javax/xml/transform/Result.html#PI_DISABLE_OUTPUT_ESCAPING"><code>Result.PI_DISABLE_OUTPUT_ESCAPING</code></a> and <a href="../../../../javax/xml/transform/Result.html#PI_ENABLE_OUTPUT_ESCAPING"><code>Result.PI_ENABLE_OUTPUT_ESCAPING</code></a>. If parameters, output properties, or other features need to be set on the Transformer handler, a <a href="../../../../javax/xml/transform/Transformer.html" title="class in javax.xml.transform"><code>Transformer</code></a> reference will need to be obtained from <a href="../../../../javax/xml/transform/sax/TransformerHandler.html#getTransformer--"><code>TransformerHandler.getTransformer()</code></a>, and the methods invoked from that reference. </p>
|
||
<p>The <a href="../../../../javax/xml/transform/sax/TemplatesHandler.html" title="interface in javax.xml.transform.sax"><code>TemplatesHandler</code></a> interface allows the creation of <a href="../../../../javax/xml/transform/Templates.html" title="interface in javax.xml.transform"><code>Templates</code></a> objects from SAX2 parse events. Once the <a href="../../../../org/xml/sax/ContentHandler.html" title="interface in org.xml.sax"><code>ContentHandler</code></a> events are complete, the Templates object may be obtained from <a href="../../../../javax/xml/transform/sax/TemplatesHandler.html#getTemplates--"><code>TemplatesHandler.getTemplates()</code></a>. Note that <a href="../../../../javax/xml/transform/sax/TemplatesHandler.html#setSystemId-java.lang.String-"><code>TemplatesHandler.setSystemId(java.lang.String)</code></a> should normally be called in order to establish a base system ID from which relative URLs may be resolved. </p>
|
||
<p>The <a href="../../../../javax/xml/transform/sax/SAXTransformerFactory.html#newXMLFilter-javax.xml.transform.Source-"><code>SAXTransformerFactory.newXMLFilter(javax.xml.transform.Source)</code></a> method allows the creation of a <a href="../../../../org/xml/sax/XMLFilter.html" title="interface in org.xml.sax"><code>XMLFilter</code></a>, which encapsulates the SAX2 notion of a "pull" transformation. The following illustrates several transformations chained together. Each filter points to a parent <a href="../../../../org/xml/sax/XMLReader.html" title="interface in org.xml.sax"><code>XMLReader</code></a>, and the final transformation is caused by invoking <a href="../../../../org/xml/sax/XMLReader.html#parse-org.xml.sax.InputSource-"><code>XMLReader.parse(org.xml.sax.InputSource)</code></a> on the final reader in the chain.</p>
|
||
</div>
|
||
</div> |