KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > xmlEngine > CharacterComponent


1 /*
2  ************************************************************************************
3  * Copyright (C) 2001-2006 Openbravo S.L.
4  * Licensed under the Apache Software License version 2.0
5  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6  * Unless required by applicable law or agreed to in writing, software distributed
7  * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8  * CONDITIONS OF ANY KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations under the License.
10  ************************************************************************************
11 */

12 package org.openbravo.xmlEngine;
13
14 import org.xml.sax.Attributes JavaDoc;
15
16 class CharacterComponent implements XmlComponentTemplate, XmlComponentValue {
17   protected String JavaDoc character;
18
19   public CharacterComponent() {}
20
21   public CharacterComponent(String JavaDoc character) {
22     this.character = character;
23   }
24
25   public CharacterComponent(String JavaDoc name, Attributes JavaDoc amap) {
26     character = new String JavaDoc("<" + name);
27     for (int i = 0; i < amap.getLength(); i++) {
28       String JavaDoc attname = amap.getQName(i);
29       String JavaDoc value = amap.getValue(i);
30       character = character + " " + attname + "=\"" + value +"\"";
31     }
32     character = character + ">";
33   }
34
35   public String JavaDoc print() {
36     return character;
37   }
38   public String JavaDoc printPrevious() {
39     return character;
40   }
41
42   public String JavaDoc printSimple() {
43     return character;
44   }
45
46   public String JavaDoc printPreviousSimple() {
47     return character;
48   }
49
50   public XmlComponentValue createXmlComponentValue(XmlDocument xmlDocument) {
51     return this; // this class is constant, therefore the XmlComponentValue is it.
52
}
53
54 }
55
Popular Tags