1 16 package org.apache.juddi.handler; 17 18 import org.apache.juddi.datatype.Phone; 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 PhoneHandler extends AbstractHandler 30 { 31 public static final String TAG_NAME = "phone"; 32 33 private HandlerMaker maker = null; 34 35 protected PhoneHandler(HandlerMaker maker) 36 { 37 this.maker = maker; 38 } 39 40 public RegistryObject unmarshal(Element element) 41 { 42 Phone obj = new Phone(); 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 Phone phone = (Phone)object; 61 Element element = parent.getOwnerDocument().createElementNS(null,TAG_NAME); 62 63 String useType = phone.getUseType(); 64 if ((useType != null) && (useType.trim().length() > 0)) 65 element.setAttribute("useType",useType); 66 67 String phoneValue = phone.getValue(); 68 if (phoneValue != null) 69 element.appendChild(parent.getOwnerDocument().createTextNode(phoneValue)); 70 71 parent.appendChild(element); 72 } 73 }
| Popular Tags
|