1 8 9 package org.uddi4j.datatype.business; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.w3c.dom.Element ; 14 15 36 public class Phone extends UDDIElement { 37 public static final String UDDI_TAG = "phone"; 38 39 protected Element base = null; 40 41 String text = null; 42 String useType = null; 43 44 50 public Phone() { 51 } 52 53 58 public Phone(String value) { 59 setText(value); 60 } 61 62 72 public Phone(Element base) throws UDDIException { 73 super(base); 75 text = getText(base); 76 useType = getAttr(base,"useType"); 77 } 78 79 private String getAttr(Element base, String attrname) 80 { 81 if(base.getAttributeNode(attrname)!=null && base.getAttributeNode(attrname).getSpecified() ) 82 { 83 return base.getAttribute(attrname); 84 } 85 return null; 86 } 87 88 public void setText(String s) { 89 text = s; 90 } 91 92 public void setUseType(String s) { 93 useType = s; 94 } 95 96 public String getText() { 97 return text; 98 } 99 100 public String getUseType() { 101 return useType; 102 } 103 104 113 public void saveToXML(Element parent) { 114 base = parent.getOwnerDocument().createElement(UDDI_TAG); 115 if (text!=null) { 117 base.appendChild(parent.getOwnerDocument().createTextNode(text)); 118 } 119 if (useType!=null) { 120 base.setAttribute("useType", useType); 121 } 122 parent.appendChild(base); 123 } 124 } 125 | Popular Tags |