1 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 namespaceURI, 31 String qualifiedName) { 32 super(owner, namespaceURI, qualifiedName); 33 } 34 35 public void setClassName(String newValue) { 36 setAttribute("class", newValue); 37 } 38 39 public String getClassName() { 40 return getAttribute("class"); 41 } 42 43 public void setXmlLang(String newValue) { 44 setAttribute("xml:lang", newValue); 45 } 46 47 public String getXmlLang() { 48 return getAttribute("xml:lang"); 49 } 50 51 public void setId(String newValue) { 52 setAttribute("id", newValue); 53 } 54 55 public String getId() { 56 return getAttribute("id"); 57 } 58 59 void setAttribute(String attr, boolean value) { 60 setAttribute(attr, value ? "true" : "false"); 61 } 62 63 boolean getAttribute(String attr, boolean defaultValue) { 64 boolean ret = defaultValue; 65 String value; 66 if (((value = getAttribute("emptyok")) != null) 67 && value.equals("true")) 68 ret = true; 69 return ret; 70 } 71 72 void setAttribute(String attr, int value) { 73 setAttribute(attr, value + ""); 74 } 75 76 int getAttribute(String attr, int defaultValue) { 77 int ret = defaultValue; 78 String value; 79 if ((value = getAttribute("emptyok")) != null) 80 ret = Integer.parseInt(value); 81 return ret; 82 } 83 } 84 | Popular Tags |