1 22 23 package org.enhydra.wireless.voicexml.dom.xerces; 24 25 import org.enhydra.apache.xerces.dom.ElementNSImpl; 26 import org.enhydra.wireless.voicexml.dom.VoiceXMLElement; 27 28 public class VoiceXMLElementImpl extends ElementNSImpl implements VoiceXMLElement { 29 30 public VoiceXMLElementImpl(VoiceXMLDocumentImpl owner, 31 String namespaceURI, 32 String qualifiedName) { 33 super(owner, namespaceURI, qualifiedName); 34 } 35 36 39 protected final boolean getBooleanAttribute(String attr, 40 boolean defaultValue) { 41 String attrVal = getAttribute(attr); 42 if (attrVal != null) { 43 return attrVal.equals("true"); 44 } else { 45 return defaultValue; 46 } 47 } 48 49 52 protected final boolean getBooleanAttribute(String attr) { 53 return getBooleanAttribute(attr, false); 54 } 55 56 59 protected final void setAttribute(String attr, 60 boolean value) { 61 setAttribute(attr, (value ? "true" : "false")); 62 } 63 64 67 protected final int getIntAttribute(String attr, 68 int defaultValue) { 69 String attrVal = getAttribute(attr); 70 if (attrVal != null) { 71 return Integer.parseInt(attrVal); 72 } else { 73 return defaultValue; 74 } 75 } 76 77 80 protected final int getIntAttribute(String attr) { 81 return getIntAttribute(attr, 0); 82 } 83 84 87 protected final void setAttribute(String attr, 88 int value) { 89 setAttribute(attr, Integer.toString(value)); 90 } 91 } 92 | Popular Tags |