1 9 10 package org.uddi4j.datatype; 11 12 import org.uddi4j.UDDIElement; 13 import org.uddi4j.UDDIException; 14 import org.w3c.dom.Element ; 15 16 35 public class Name extends UDDIElement { 36 public static final String UDDI_TAG = "name"; 37 38 protected Element base = null; 39 40 String text = null; 41 String lang = null; 42 43 49 public Name() { 50 } 51 52 57 public Name(String value) { 58 setText(value); 59 } 60 61 67 public Name(String value, String lang){ 68 setText(value); 69 setLang(lang); 70 } 71 72 73 82 public Name(Element base) throws UDDIException { 83 super(base); 85 text = getText(base); 86 lang = getAttr(base,"xml:lang"); 87 } 88 89 private String getAttr(Element base, String attrname) 90 { 91 97 return base.getAttribute(attrname); 100 } 103 104 public void setText(String s) { 105 text = s; 106 } 107 108 114 public void setLang(String s) { 115 lang = s; 116 } 117 118 public String getText() { 119 return text; 120 } 121 122 public String getLang() { 123 return lang; 124 } 125 126 135 public void saveToXML(Element parent) { 136 base = parent.getOwnerDocument().createElement(UDDI_TAG); 137 if (text!=null) { 139 base.appendChild(parent.getOwnerDocument().createTextNode(text)); 140 } 141 if ((lang !=null) && !(lang.equals("")) ) { 142 base.setAttribute("xml:lang", lang); 143 } 144 parent.appendChild(base); 145 } 146 } 147 | Popular Tags |