/** * Converts an XML element into an <code>EppCommandRenewXriName</code> object. The caller of this * method must make sure that the root node is of an EPP Command Renew entity for EPP XRI I-Name * object * * @param root root node for an <code>EppCommandRenewXriName</code> object in XML format * @return an <code>EppCommandRenewXriName</code> object, or null if the node is invalid */ public static EppEntity fromXML(Node root) { EppCommandRenewXriName cmd = null; String iname = null; Calendar curExpDate = null; EppPeriod period = null; NodeList list = root.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); String name = node.getLocalName(); if (name == null) { continue; } if (name.equals("iname")) { iname = EppUtil.getText(node); } else if (name.equals("curExpDate")) { curExpDate = EppUtil.getDate(node, true); } else if (name.equals("period")) { period = (EppPeriod) EppPeriod.fromXML(node); } } if (iname != null) { cmd = new EppCommandRenewXriName(iname, curExpDate, period, null); } return cmd; }
/** * Converts an XML element into an <code>EppResponseDataRenewXriNumber</code> object. The caller * of this method must make sure that the root node is the resData element of EPP responseType for * creating an EPP XRI I-Number object * * @param root root node for an <code>EppResponseDataRenewXriNumber</code> object in XML format * @return an <code>EppResponseDataRenewXriNumber</code> object, or null if the node is invalid */ public static EppEntity fromXML(Node root) { String i_number = null; Calendar exDate = null; NodeList list = root.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); String name = node.getLocalName(); if (name == null) { continue; } else if (name.equals("inumber")) { i_number = EppUtil.getText(node); } else if (name.equals("exDate")) { exDate = EppUtil.getDate(node); } } return new EppResponseDataRenewXriNumber(i_number, exDate); }
/** * Converts an XML element into an <code>EppXriAuthority</code> object. The caller of this method * must make sure that the root node is of the EPP Authority type. * * @param root root node for an <code>EppXriAuthority</code> object in XML format * @return an <code>EppXriAuthority</code> object, or null if the node is invalid */ public static EppEntity fromXML(Node root) { EppXriAuthority authority = new EppXriAuthority(); NodeList list = root.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); String name = node.getLocalName(); if (name == null) { continue; } if (name.equals("authId")) { authority.setAuthorityId(EppUtil.getText(node)); } if (name.equals("isEscrow")) { authority.setIsEscrow(EppUtil.getTextAsBool(node)); } if (name.equals("isContact")) { authority.setIsContact(EppUtil.getTextAsBool(node)); } if (name.equals("escrowAgent")) { EppXriTrustee agent = (EppXriTrustee) EppXriTrustee.fromXML(node); if (agent != null) authority.setEscrowAgent(agent); } if (name.equals("contactAgent")) { EppXriTrustee agent = (EppXriTrustee) EppXriTrustee.fromXML(node); if (agent != null) authority.setContactAgent(agent); } else if (name.equals("socialData")) { EppXriSocialData socialData = (EppXriSocialData) EppXriSocialData.fromXML(node); if (socialData != null) { authority.setSocialData(socialData); } } else if (name.equals("trustee")) { EppXriTrustee trustee = (EppXriTrustee) EppXriTrustee.fromXML(node); if (trustee != null) { authority.addTrustee(trustee); } } else if (name.equals("contactId")) { EppXriContactData con = (EppXriContactData) EppXriContactData.fromXML(node); if (con != null) { authority.addContactHandle(con); } } else if (name.equals("ref")) { EppXriRef ref = (EppXriRef) EppXriRef.fromXML(node); if (ref != null) { authority.addRef(ref); } } else if (name.equals("redirect")) { EppXriURI redirect = (EppXriURI) EppXriURI.fromXML(node); if (redirect != null) { authority.addRedirect(redirect); } } else if (name.equals("equivID")) { EppXriSynonym equivID = (EppXriSynonym) EppXriSynonym.fromXML(node); if (equivID != null) { authority.addEquivID(equivID); } } if (name.equals("canonicalEquivID")) { authority.setCanonicalEquivID(EppUtil.getText(node)); } else if (name.equals("sep")) { EppXriServiceEndpoint sep = (EppXriServiceEndpoint) EppXriServiceEndpoint.fromXML(node); if (sep != null) { authority.addServiceEndpoint(sep); } } else if (name.equals("iname")) { authority.addIName(EppUtil.getText(node)); } else if (name.equals("inumber")) { EppXriNumberAttribute xin = (EppXriNumberAttribute) EppXriNumberAttribute.fromXML(node); if (xin != null) { authority.addINumber(xin); } } else if (name.equals("iservice")) { authority.addIService(EppUtil.getText(node)); } else if (name.equals("authInfo")) { EppAuthInfo authInfo = (EppAuthInfo) EppAuthInfo.fromXML(node); if (authInfo != null) { authority.setAuthInfo(authInfo); } } else if (name.equals("extension")) { authority.setExtension(EppUtil.getText(node)); } else { authority.fromXMLCommon(node, name); } } return authority; }