所有类


org.xml.sax
类 HandlerBase

java.lang.Object
  继承者 org.xml.sax.HandlerBase
所有已实现的接口:
DocumentHandler, DTDHandler, EntityResolver, ErrorHandler

已过时。 此类可可以与不推荐使用的 DocumentHandler 接口一起工作。它已经被 SAX2 DefaultHandler 类所取代。

public class HandlerBase
   
   
   
   
     
     
extends Object
implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler

处理程序的默认基类。

此模块(包括源代码和文档)在公共域中,同时 没有担保有关更多信息,请参阅http://www.saxproject.org

此类可实现以下四个 SAX1 接口的默认行为:EntityResolver、DTDHandler、DocumentHandler 和 ErrorHandler。此类现已废弃,但它包括在 SAX2 中用来支持遗留的 SAX1 应用程序。而 SAX2 应用程序应该使用 DefaultHandler 类。

应用程序编写者可以在他们仅需实现部分接口时扩展此类;当应用程序尚未提供其自己的处理程序时解析器编写者可通过实例化此类来提供默认的处理程序。

注意,使用此类是可选的。

从以下版本开始:
SAX 1.0
另请参见:
EntityResolver, DTDHandler, DocumentHandler, ErrorHandler

构造方法摘要
HandlerBase()
          已过时。  
 
方法摘要
 voidcharacters(char[] ch, int start, int length)
          已过时。 接收元素内字符数据的通知。
 voidendDocument()
          已过时。 接收文档结束的通知。
 voidendElement(String name)
          已过时。 接收元素结束的通知。
 voiderror(SAXParseException e)
          已过时。 接收可恢复的解析器错误的通知。
 voidfatalError(SAXParseException e)
          已过时。 报告严重的 XML 解析错误。
 voidignorableWhitespace(char[] ch, int start, int length)
          已过时。 接收元素内容中可忽略的空白的通知。
 voidnotationDecl(String name, String publicId, String systemId)
          已过时。 接收注释声明的通知。
 voidprocessingInstruction(String target, String data)
          已过时。 接收处理指令的通知。
 InputSourceresolveEntity(String publicId, String systemId)
          已过时。 解析外部实体。
 voidsetDocumentLocator(Locator locator)
          已过时。 接收文档事件的 Locator 对象。
 voidstartDocument()
          已过时。 接收文档开始的通知。
 voidstartElement(String name, AttributeList attributes)
          已过时。 接收元素开始的通知。
 voidunparsedEntityDecl(String name, String publicId, String systemId, String notationName)
          已过时。 接收未解析的实体声明的通知。
 voidwarning(SAXParseException e)
          已过时。 接收解析器警告的通知。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

HandlerBase

public HandlerBase()
已过时。 
方法详细信息

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException
已过时。 
解析外部实体。

将始终返回 null,因此解析器将使用 XML 文档中提供的系统标识符。此方法实现 SAX 默认的行为:应用程序编写者可以在子类中重写它以便进行诸如目录查找或 URI 重定向之类的特定转换。

指定者:
接口 EntityResolver 中的 resolveEntity
参数:
publicId - 公共标识符,如果没有可用的则为 null。
systemId - XML 文档中提供的系统标识符。
返回:
新的输入源,或返回 null以要求默认的行为。
抛出:
SAXException - 任何 SAX 异常,可能包装另外的异常。
另请参见:
EntityResolver.resolveEntity(java.lang.String, java.lang.String)

notationDecl

public void notationDecl(String name,
                         String publicId,
                         String systemId)
已过时。 
接收注释声明的通知。

默认为不执行任何操作。如果应用程序编写者希望跟踪在文档中声明的注释,则可以在子类中重写此方法。

指定者:
接口 DTDHandler 中的 notationDecl
参数:
name - 注释名称。
publicId - 注释公共标识符,如果没有可使用的则为 null。
systemId - 注释系统标识符。
另请参见:
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)

unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               String publicId,
                               String systemId,
                               String notationName)
已过时。 
接收未解析的实体声明的通知。

默认为不执行任何操作。应用程序编写者可以在子类中重写此方法,以便跟踪在文档中声明的未解析实体。

指定者:
接口 DTDHandler 中的 unparsedEntityDecl
参数:
name - 实体名称。
publicId - 实体公共标识符,如果不可用则为 null。
systemId - 实体系统标识符。
notationName - 相关注释的名称。
另请参见:
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

setDocumentLocator

public void setDocumentLocator(Locator locator)
已过时。 
接收文档事件的 Locator 对象。

默认为不执行任何操作。如果应用程序编写者希望存储定位器以用于其他的文档事件,则可以在子类中重写此方法。

指定者:
接口 DocumentHandler 中的 setDocumentLocator
参数:
locator - 用于所有 SAX 文档事件的定位器。
另请参见:
DocumentHandler.setDocumentLocator(org.xml.sax.Locator), Locator

startDocument

public void startDocument()
                   throws SAXException
已过时。 
接收文档开始的通知。

默认为不执行任何操作。应用程序编写者可以在子类中重写此方法,以便在文档的开始采取特定的措施(如分配树的根节点或创建输出文件)。

指定者:
接口 DocumentHandler 中的 startDocument
抛出:
SAXException - 任何 SAX 异常,可能包装另外的异常。
另请参见:
DocumentHandler.startDocument()

endDocument

public void endDocument()
                 throws SAXException
已过时。 
接收文档结束的通知。

默认为不执行任何操作。应用程序编写者可以在子类中重写此方法,以便在文档开始采取特定的措施(如结束树或关闭输出文件)。

指定者:
接口 DocumentHandler 中的 endDocument
抛出:
SAXException - 任何 SAX 异常,可能包装另外的异常。
另请参见:
DocumentHandler.endDocument()

startElement

public void startElement(String name,
                         AttributeList attributes)
                  throws SAXException
已过时。 
接收元素开始的通知。

默认为不执行任何操作。应用程序编写者可以在子类中重写此方法,以便在每个元素开始时采取特定的措施(如向文件分配新的树节点或把输出写入到文件)。

指定者:
接口 DocumentHandler 中的 startElement
参数:
name - 元素类型名称。
attributes - 指定的或默认的属性。
抛出:
SAXException - 任何 SAX 异常,可能包装另外的异常。
另请参见:
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)