Register callback implementations (by using a class that extends DefaultHandler, for example).
注册回调实现(例如,通过使用继承defaulthandler的类)。
Default implementations provided by DefaultHandler are retained for other event processing methods.
对于其它事件处理方法,由保留defaulthandler提供缺省实现。
The easiest solution to declare an event handler is to inherit from the SAX-provided defaulthandler.
声明事件处理器的最简单方案是继承SAX提供的defaulthandler。
To simplify work, SAX provides a default implementation for these interfaces in the DefaultHandler class.
为简化工作,SAX在defaulthandler类中提供了这些接口的缺省实现。
The major difference is that variations of the parse() method do not take an instance of the SAX DefaultHandler class.
主要差别在于parse()方法的变种不接受SAXDefaultHandler 类的实例。
Listing 2 only registers a DefaultHandler object that simply prints validation errors on the console, as shown in Listing 3.
清单2仅仅注册了一个DefaultHandler对象,该对象只是在控制台上打印验证错误,如清单3所示。
Similarly, when using SAX 2.0, it will be obvious that the methods that accept DefaultHandler instances and return XMLReaders will be used.
同样,在使用SAX 2.0 时,很明显,应该使用那些接收DefaultHandler实例并返回XMLReader的方法。
A handler has to be created for these events by either implementing an interface or extending the DefaultHandler class and overriding its methods as needed.
必须通过实现接口或者扩展DefaultHandler类并根据需要重写它的方法,创建这些事件的handler。
In most cases, it is easier to extend DefaultHandler and override the methods that are relevant for the application rather than to implement an interface directly.
在大多数情况下,为应用程序扩展DefaultHandler并覆盖相关的方法要比直接实现一个接口更容易。
Sax also provides a class called DefaultHandler (in the org.xml.sax.helpers package) that implements all of these callbacks and provides default, empty implementations of all the callback methods.
sax还提供一个叫做DefaultHandler的类(在or g . xml . sax .helpers软件包中)来实现所有这些回调,并提供所有回调方法默认的空实现。
Sax also provides a class called DefaultHandler (in the org.xml.sax.helpers package) that implements all of these callbacks and provides default, empty implementations of all the callback methods.
sax还提供一个叫做DefaultHandler的类(在or g . xml . sax .helpers软件包中)来实现所有这些回调,并提供所有回调方法默认的空实现。
应用推荐