KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > taglib > jxpath > core > OutTag


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 package org.apache.cocoon.taglib.jxpath.core;
17
18 import org.apache.cocoon.taglib.VarXMLProducerTagSupport;
19
20 import org.xml.sax.Attributes JavaDoc;
21 import org.xml.sax.SAXException JavaDoc;
22
23 /**
24  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
25  * @version CVS $Id: OutTag.java 30932 2004-07-29 17:35:38Z vgritsenko $
26  */

27 public class OutTag extends VarXMLProducerTagSupport {
28     private String JavaDoc value;
29     
30     /*
31      * @see Tag#doStartTag(String, String, String, Attributes)
32      */

33     public int doStartTag(String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc qName, Attributes JavaDoc atts) throws SAXException JavaDoc {
34         if (value != null) {
35             //JXPathContext context = JXPathCocoonContexts.getRequestContext(objectModel);
36
Object JavaDoc retValue = getVariable(value);
37             if (retValue != null) {
38                 if (var != null) {
39                     setVariable(var, retValue);
40                     //context.setValue(var, retValue);
41
//setAttribute(var, retValue);
42
} else {
43                     char[] charArray = retValue.toString().toCharArray();
44                     this.xmlConsumer.characters(charArray, 0, charArray.length);
45                 }
46             }
47         }
48         return EVAL_BODY;
49     }
50     
51     public void setValue(String JavaDoc value) {
52         this.value = value;
53     }
54
55     /*
56      * @see Recyclable#recycle()
57      */

58     public void recycle() {
59         this.value = null;
60         super.recycle();
61     }
62 }
63
Popular Tags