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