EppCommandCheckContact * EppCommandCheckContact::fromXML( const DOM_Node& root )
{
	EppCommandCheckContact * cmd = new EppCommandCheckContact();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("id") || name.equals("contact:id") )
		{
			DOMString id = EppUtil::getText(node);
			cmd->addId(id);
		}
	}

	return cmd;
}
EppCommandLogin * EppCommandLogin::fromXML( const DOM_Node& root )
{
	EppCommandLogin * cmd = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("svcs") )
		{
			EppServiceMenu * menu = EppServiceMenu::fromXML(node);
			if( menu != null )
			{
				cmd = new EppCommandLogin(*menu);
				delete menu;
				return cmd;
			}
		}
	}

	return null;
}
EppResponseDataTransferContact * EppResponseDataTransferContact::fromXML( const DOM_Node& root )
{
	EppResponseDataTransferContact * res = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("id") )
		if( name.equals("id") || name.equals("contact:id") )
		{
			if( res == null )
			{
				DOMString id = EppUtil::getText(node);
				res = new EppResponseDataTransferContact(id);
			}
		}
		else if( res != null )
		{
			res->fromXMLCommon(node, name);
		}
	}

	return res;
}
EppCommandInfoSvcsub * EppCommandInfoSvcsub::fromXML( const DOM_Node& root )
{
	EppCommandInfoSvcsub * cmd = null;
	EppAuthInfo * authInfo = null;
	DOMString userid = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("id") )
		if( name.equals("id") || name.equals("svcsub:id") )
		{
			DOMString id = EppUtil::getText(node);
			if( cmd == null )
			{
				cmd = new EppCommandInfoSvcsub(id);
			}
		}
//		if( name.equals("userid") )
		if( name.equals("userid") || name.equals("svcsub:userid") )
		{
			userid = EppUtil::getText(node);
		}
//		else if( name.equals("authInfo") )
		else if( name.equals("authInfo") || name.equals("svcsub:authInfo") )
		{
			if( authInfo == null )
			{
				authInfo = EppAuthInfo::fromXML(node);
			}
		}
	}
	if( cmd != null )
	{
		cmd->authInfo = authInfo;
		cmd->userid = userid;
	}
	else if( authInfo != null )
	{
		delete authInfo;
	}

	return cmd;
}
EppContact * EppContact::fromXML( const DOM_Node& root )
{
	EppContact * contact = new EppContact();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.substringData(0, 8).equals("contact:") )
		{
			name = name.substringData(8, name.length() - 8);
		}
		if( name.equals("id") )
		{
			contact->id = EppUtil::getText(node);
		}
		else if( name.equals("ascii") )
		{
			contact->ascii = EppContactData::fromXML(node);
		}
		else if( name.equals("i15d") )
		{
			contact->i15d = EppContactData::fromXML(node);
		}
		else if( name.equals("voice") )
		{
			contact->voice = EppE164::fromXML(node);
		}
		else if( name.equals("fax") )
		{
			contact->fax = EppE164::fromXML(node);
		}
		else if( name.equals("email") )
		{
			contact->email = EppUtil::getText(node);
		}
		else
		{
			contact->fromXMLCommon(node, name);
		}
	}

	return contact;
}
EppCommandRenew * EppCommandRenew::fromXML( const DOM_Node& root )
{
	DOMString command = root.getLocalName();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString prefix = node.getPrefix();
		DOMString name = node.getLocalName();
/*
		if( (prefix == null) || (name == null) )
		{
			continue;
		}
		if( name.equals(command) )
		{
			if( prefix.equals("domain") )
			{
				return EppCommandRenewDomain.fromXML(node);
			}
			else if( prefix.equals("svcsub") )
			{
				return EppCommandRenewSvcsub.fromXML(node);
			}
		}
*/
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name.equals("domain:renew") )
		{
			return EppCommandRenewDomain::fromXML(node);
		}
		else if( name.equals("svcsub:renew") )
		{
			return EppCommandRenewSvcsub::fromXML(node);
		}
	}

	return null;
}
Exemplo n.º 7
0
EppHost * EppHost::fromXML( const DOM_Node& root )
{
	EppHost * host = new EppHost();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.substringData(0, 5).equals("host:") )
		{
			name = name.substringData(5, name.length() - 5);
		}
		if( name.equals("name") )
		{
			host->setName(EppUtil::getText(node));
		}
		else if( name.equals("addr") )
		{
			EppIpAddress * ip = EppIpAddress::fromXML(node);
			if ( ip != null )
			{
				host->addAddress(*ip);
				delete ip;
			}
		}
		else
		{
			host->fromXMLCommon(node, name);
		}
	}

   	return host;
}
EppResponseDataCreateDomain * EppResponseDataCreateDomain::fromXML( const DOM_Node& root )
{
	DOMString roid = null;
	DOMString domain = null;
	time_t exDate = 0;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("roid") )
		if( name.equals("roid") || name.equals("domain:roid") )
		{
			roid = EppUtil::getText(node);
		}
//		else if( name.equals("name") )
		else if( name.equals("name") || name.equals("domain:name") )
		{
			domain = EppUtil::getText(node);
		}
//		else if( name.equals("exDate") )
		else if( name.equals("exDate") || name.equals("domain:exDate") )
		{
			exDate = EppUtil::getDate(node);
		}
	}

	return new EppResponseDataCreateDomain(domain, roid, exDate);
}
EppGreeting * EppGreeting::fromXML( const DOM_Node &root )
{
	unsigned int i;
	EppGreeting * greeting = null;
	DOM_NodeList list = root.getChildNodes();
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("greeting") )
		{
			greeting = new EppGreeting();
			list = node.getChildNodes();
			break;
		}
	}

	if( greeting == null )
	{
		return null;
	}

	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("svID") )
		{
			greeting->svID = EppUtil::getText(node);
		}
		else if( name.equals("svDate") )
		{
			greeting->svDate = EppUtil::getDate(node);
		}
		else if( name.equals("svcMenu") )
		{
			if( greeting->svcMenu != null )
			{
				delete greeting->svcMenu;
			}
			greeting->svcMenu = EppServiceMenu::fromXML(node);
		}
	}

	return greeting;
}
Exemplo n.º 10
0
EppCommand * EppCommand::fromXML( const DOM_Node& root )
{
	unsigned int i;
	EppCommand * cmd = null;
	DOM_Node command;
	bool found = false;

	DOM_NodeList list = root.getChildNodes();
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("command") )
		{
			command = node;
			found = true;
			break;
		}
	}

	if( found == false )
	{
		return null;
	}

	list = command.getChildNodes();
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("login") )
		{
			cmd = EppCommandLogin::fromXML(node);
		}
		else if( name.equals("logout") )
		{
			cmd = EppCommandLogout::fromXML(node);
		}
		else if( name.equals("poll") )
		{
			cmd = EppCommandPoll::fromXML(node);
		}
		else if( name.equals("create") )
		{
			cmd = EppCommandCreate::fromXML(node);
		}
		else if( name.equals("delete") )
		{
			cmd = EppCommandDelete::fromXML(node);
		}
		else if( name.equals("info") )
		{
			cmd = EppCommandInfo::fromXML(node);
		}
		else if( name.equals("check") )
		{
			cmd = EppCommandCheck::fromXML(node);
		}
		else if( name.equals("renew") )
		{
			cmd = EppCommandRenew::fromXML(node);
		}
		else if( name.equals("transfer") )
		{
			cmd = EppCommandTransfer::fromXML(node);
		}
		else if( name.equals("update") )
		{
			cmd = EppCommandUpdate::fromXML(node);
		}
		/*
		 * other commands
		 */
		if( cmd != null )
		{
			break;
		}
	}
	if( cmd == null )
	{
		return null;
	}
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("creds") )
		{
			if( cmd->creds == null )
			{
				cmd->creds = EppCreds::fromXML(node);
			}
		}
		else if( name.equals("unspec") )
		{
			if( cmd->unspec == null )
			{
				cmd->unspec = EppUnspec::fromXML(node);
			}
		}
		else if( name.equals("clTRID") )
		{
			cmd->clTRID = EppUtil::getText(node);
		}
	}

	return cmd;
}