1 57 package org.enhydra.apache.wml.dom; 58 59 import org.enhydra.apache.wml.WMLElement; 60 import org.enhydra.apache.xerces.dom.ElementImpl; 61 62 66 public class WMLElementImpl extends ElementImpl implements WMLElement { 67 68 public WMLElementImpl (WMLDocumentImpl owner, String tagName) { 69 super(owner, tagName); 70 } 71 72 public void setClassName(String newValue) { 73 setAttribute("class", newValue); 74 } 75 76 public String getClassName() { 77 return getAttribute("class"); 78 } 79 80 public void setXmlLang(String newValue) { 81 setAttribute("xml:lang", newValue); 82 } 83 84 public String getXmlLang() { 85 return getAttribute("xml:lang"); 86 } 87 88 public void setId(String newValue) { 89 setAttribute("id", newValue); 90 } 91 92 public String getId() { 93 return getAttribute("id"); 94 } 95 96 void setAttribute(String attr, boolean value) { 97 setAttribute(attr, value ? "true" : "false"); 98 } 99 100 boolean getAttribute(String attr, boolean defaultValue) { 101 boolean ret = defaultValue; 102 String value; 103 if (((value = getAttribute("emptyok")) != null) 104 && value.equals("true")) 105 ret = true; 106 return ret; 107 } 108 109 void setAttribute(String attr, int value) { 110 setAttribute(attr, value + ""); 111 } 112 113 int getAttribute(String attr, int defaultValue) { 114 int ret = defaultValue; 115 String value; 116 if ((value = getAttribute("emptyok")) != null) 117 ret = Integer.parseInt(value); 118 return ret; 119 } 120 } 121 | Popular Tags |