1 16 package org.apache.juddi.handler; 17 18 import org.apache.juddi.datatype.Email; 19 import org.apache.juddi.datatype.RegistryObject; 20 import org.apache.juddi.util.xml.XMLUtils; 21 import org.w3c.dom.Element ; 22 23 29 public class EmailHandler extends AbstractHandler 30 { 31 public static final String TAG_NAME = "email"; 32 33 private HandlerMaker maker = null; 34 35 protected EmailHandler(HandlerMaker maker) 36 { 37 this.maker = maker; 38 } 39 40 public RegistryObject unmarshal(Element element) 41 { 42 Email obj = new Email(); 43 44 String useType = element.getAttribute("useType"); 46 if ((useType != null) && (useType.trim().length() > 0)) 47 obj.setUseType(useType); 48 49 obj.setValue(XMLUtils.getText(element)); 51 52 55 return obj; 56 } 57 58 public void marshal(RegistryObject object,Element parent) 59 { 60 Email email = (Email)object; 61 Element element = parent.getOwnerDocument().createElementNS(null,TAG_NAME); 62 63 String useType = email.getUseType(); 64 if ((useType != null) && (useType.trim().length() > 0)) 65 element.setAttribute("useType",useType); 66 67 String emailValue = email.getValue(); 68 if (emailValue != null) 69 element.appendChild(parent.getOwnerDocument().createTextNode(emailValue)); 70 71 parent.appendChild(element); 72 } 73 } | Popular Tags |