KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > wireless > wml > dom > xerces > WMLElementImpl


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Original Code is DigitalSesame
15  * Portions created by DigitalSesame are Copyright (C) 1997-2000 DigitalSesame
16  * All Rights Reserved.
17  *
18  * Contributor(s):
19  *
20  * $Id: WMLElementImpl.java,v 1.2 2005/01/26 08:28:45 jkjome Exp $
21  */

22 package org.enhydra.wireless.wml.dom.xerces;
23
24 import org.enhydra.apache.xerces.dom.ElementNSImpl;
25 import org.enhydra.wireless.wml.dom.WMLElement;
26
27 public class WMLElementImpl extends ElementNSImpl implements WMLElement {
28
29     public WMLElementImpl(WMLDocumentImpl owner,
30                           String JavaDoc namespaceURI,
31                           String JavaDoc qualifiedName) {
32     super(owner, namespaceURI, qualifiedName);
33     }
34
35     public void setClassName(String JavaDoc newValue) {
36     setAttribute("class", newValue);
37     }
38
39     public String JavaDoc getClassName() {
40     return getAttribute("class");
41     }
42
43     public void setXmlLang(String JavaDoc newValue) {
44     setAttribute("xml:lang", newValue);
45     }
46
47     public String JavaDoc getXmlLang() {
48     return getAttribute("xml:lang");
49     }
50
51     public void setId(String JavaDoc newValue) {
52     setAttribute("id", newValue);
53     }
54     
55     public String JavaDoc getId() {
56     return getAttribute("id");
57     }
58
59     void setAttribute(String JavaDoc attr, boolean value) {
60     setAttribute(attr, value ? "true" : "false");
61     }
62
63     boolean getAttribute(String JavaDoc attr, boolean defaultValue) {
64     boolean ret = defaultValue;
65     String JavaDoc value;
66     if (((value = getAttribute("emptyok")) != null)
67         && value.equals("true"))
68         ret = true;
69     return ret;
70     }
71
72     void setAttribute(String JavaDoc attr, int value) {
73     setAttribute(attr, value + "");
74     }
75
76     int getAttribute(String JavaDoc attr, int defaultValue) {
77     int ret = defaultValue;
78     String JavaDoc value;
79     if ((value = getAttribute("emptyok")) != null)
80         ret = Integer.parseInt(value);
81     return ret;
82     }
83 }
84
Popular Tags