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 34 public class AddressLine extends UDDIElement { 35 public static final String UDDI_TAG = "addressLine"; 36 37 protected Element base = null; 38 39 String text = null; 40 String keyName = null; 41 String keyValue = null; 42 43 49 public AddressLine() { 50 } 51 52 57 public AddressLine(String value) { 58 setText(value); 59 } 60 61 71 72 public AddressLine(Element base) throws UDDIException { 73 super(base); 75 keyName = getAttr(base,"keyName"); 76 keyValue = getAttr(base,"keyValue"); 77 text = getText(base); 78 } 79 80 private String getAttr(Element base, String attrname) 81 { 82 if(base.getAttributeNode(attrname)!=null && base.getAttributeNode(attrname).getSpecified() ) 83 { 84 return base.getAttribute(attrname); 85 } 86 return null; 87 } 88 89 90 93 public void setKeyName (String keyName) { 94 this.keyName = keyName; 95 } 96 97 100 public void setKeyValue (String keyValue) { 101 this.keyValue = keyValue; 102 } 103 104 public void setText(String s) { 105 text = s; 106 } 107 108 public String getKeyName () { 109 return keyName; 110 } 111 112 public String getKeyValue () { 113 return keyValue; 114 } 115 116 public String getText() { 117 return text; 118 } 119 120 129 public void saveToXML(Element parent) { 130 base = parent.getOwnerDocument().createElement(UDDI_TAG); 131 133 if (keyName != null) { 134 base.setAttribute("keyName", keyName); 135 } 136 137 if (keyValue != null) { 138 base.setAttribute("keyValue", keyValue); 139 } 140 141 if (text!=null) { 142 base.appendChild(parent.getOwnerDocument().createTextNode(text)); 143 } 144 parent.appendChild(base); 145 } 146 } 147 | Popular Tags |