KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > processor > ProcessorAttributeSet


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: ProcessorAttributeSet.java,v 1.8 2004/02/11 18:15:51 minchau Exp $
18  */

19 package org.apache.xalan.processor;
20
21 import javax.xml.transform.TransformerException JavaDoc;
22
23 import org.apache.xalan.templates.ElemAttributeSet;
24 import org.apache.xalan.templates.ElemTemplateElement;
25
26 import org.xml.sax.Attributes JavaDoc;
27
28 /**
29  * This class processes parse events for an xsl:attribute-set.
30  * @see <a HREF="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
31  * @see <a HREF="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in XSLT Specification</a>
32  */

33 class ProcessorAttributeSet extends XSLTElementProcessor
34 {
35
36   /**
37    * Receive notification of the start of an xsl:attribute-set element.
38    *
39    * @param handler The calling StylesheetHandler/TemplatesBuilder.
40    * @param uri The Namespace URI, or the empty string if the
41    * element has no Namespace URI or if Namespace
42    * processing is not being performed.
43    * @param localName The local name (without prefix), or the
44    * empty string if Namespace processing is not being
45    * performed.
46    * @param rawName The raw XML 1.0 name (with prefix), or the
47    * empty string if raw names are not available.
48    * @param attributes The attributes attached to the element. If
49    * there are no attributes, it shall be an empty
50    * Attributes object.
51    *
52    * @see org.apache.xalan.processor.StylesheetHandler#startElement
53    * @see org.xml.sax.ContentHandler#startElement
54    * @see org.xml.sax.ContentHandler#endElement
55    * @see org.xml.sax.Attributes
56    */

57   public void startElement(
58           StylesheetHandler handler, String JavaDoc uri, String JavaDoc localName, String JavaDoc rawName, Attributes JavaDoc attributes)
59             throws org.xml.sax.SAXException JavaDoc
60   {
61
62     ElemAttributeSet eat = new ElemAttributeSet();
63
64     eat.setLocaterInfo(handler.getLocator());
65     try
66     {
67       eat.setPrefixes(handler.getNamespaceSupport());
68     }
69     catch(TransformerException JavaDoc te)
70     {
71       throw new org.xml.sax.SAXException JavaDoc(te);
72     }
73
74     eat.setDOMBackPointer(handler.getOriginatingNode());
75     setPropertiesFromAttributes(handler, rawName, attributes, eat);
76     handler.getStylesheet().setAttributeSet(eat);
77
78     // handler.pushElemTemplateElement(eat);
79
ElemTemplateElement parent = handler.getElemTemplateElement();
80
81     parent.appendChild(eat);
82     handler.pushElemTemplateElement(eat);
83   }
84
85   /**
86    * Receive notification of the end of an element.
87    *
88    * @param name The element type name.
89    * @param attributes The specified or defaulted attributes.
90    *
91    * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
92    * @param uri The Namespace URI, or an empty string.
93    * @param localName The local name (without prefix), or empty string if not namespace processing.
94    * @param rawName The qualified name (with prefix).
95    */

96   public void endElement(
97           StylesheetHandler handler, String JavaDoc uri, String JavaDoc localName, String JavaDoc rawName)
98             throws org.xml.sax.SAXException JavaDoc
99   {
100     handler.popElemTemplateElement();
101   }
102 }
103
Popular Tags