01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.taglib.jxpath.core;
18:
19: import org.apache.cocoon.taglib.VarXMLProducerTagSupport;
20:
21: import org.xml.sax.Attributes;
22: import org.xml.sax.SAXException;
23:
24: /**
25: * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
26: * @version CVS $Id: OutTag.java 433543 2006-08-22 06:22:54Z crossley $
27: */
28: public class OutTag extends VarXMLProducerTagSupport {
29: private String value;
30:
31: /*
32: * @see Tag#doStartTag(String, String, String, Attributes)
33: */
34: public int doStartTag(String namespaceURI, String localName,
35: String qName, Attributes atts) throws SAXException {
36: if (value != null) {
37: //JXPathContext context = JXPathCocoonContexts.getRequestContext(objectModel);
38: Object retValue = getVariable(value);
39: if (retValue != null) {
40: if (var != null) {
41: setVariable(var, retValue);
42: //context.setValue(var, retValue);
43: //setAttribute(var, retValue);
44: } else {
45: char[] charArray = retValue.toString()
46: .toCharArray();
47: this .xmlConsumer.characters(charArray, 0,
48: charArray.length);
49: }
50: }
51: }
52: return EVAL_BODY;
53: }
54:
55: public void setValue(String value) {
56: this .value = value;
57: }
58:
59: /*
60: * @see Recyclable#recycle()
61: */
62: public void recycle() {
63: this.value = null;
64: super.recycle();
65: }
66: }
|