KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > handlers > ElementHandlerBase


1 package com.icl.saxon.handlers;
2 import com.icl.saxon.Context;
3 import com.icl.saxon.om.NodeInfo;
4 import javax.xml.transform.TransformerException JavaDoc;
5
6 /**
7  * This class is the default element handler from which
8  * user-defined element handlers can inherit. It is provided for convenience:
9  * use is optional. The individual methods of the default element handler
10  * do nothing with the content; in a subclass it is therefore only necessary to implement
11  * those methods that need to do something specific.<P>
12  * The startElement() method calls applyTemplates(), so child elements will
13  * always be processed.<P>
14  * @author <A HREF="mailto:mhkay@iclway.co.uk>Michael H. Kay</A>
15  */

16  
17 public class ElementHandlerBase extends ElementHandler {
18
19     /**
20     * implement start() method
21     */

22
23     public void start(NodeInfo node, Context context) throws TransformerException JavaDoc {
24         if (node.getNodeType() != NodeInfo.ELEMENT)
25             throw new TransformerException JavaDoc("Element Handler called for a node that is not an element");
26         startElement(node, context);
27     }
28
29     /**
30     * Define action to be taken before an element of this element type.<BR>
31     * Default implementation does nothing, other than causing subordinate elements
32     * to be processed in the same mode as the caller
33     * @param e The NodeInfo object for the current element.
34     */

35     
36     public void startElement( NodeInfo e, Context context ) throws TransformerException JavaDoc {
37         context.getController().applyTemplates(
38                     context, null, context.getMode(), null);
39     }
40
41     public boolean needsStackFrame() {
42         return false;
43     }
44
45 }
46
47 //
48
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
49
// you may not use this file except in compliance with the License. You may obtain a copy of the
50
// License at http://www.mozilla.org/MPL/
51
//
52
// Software distributed under the License is distributed on an "AS IS" basis,
53
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
54
// See the License for the specific language governing rights and limitations under the License.
55
//
56
// The Original Code is: all this file.
57
//
58
// The Initial Developer of the Original Code is
59
// Michael Kay of International Computers Limited (mhkay@iclway.co.uk).
60
//
61
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
62
//
63
// Contributor(s): none.
64
//
65
Popular Tags