예제 #1
0
ret_ CXMLLoaderActions::LoadEnable(CProgram &Program,
								   const DOMElement *pElement)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif
	auto_xerces_str wsName("name");
	auto_xerces_str sName(pElement->getAttribute(wsName));
	
	// Check if there is the container
	if (!m_pTmpContainer)
		return XML_LOADER_ERROR;

	// Check if there is the button identified by the attribute
	CWindow *pWindow = m_pTmpContainer->GetChild(sName);

	if (!pWindow || WINDOW_BUTTON != pWindow->Type())
		return XML_LOADER_ERROR;

	auto_xerces_str wsEnable("enable");
	auto_xerces_str sEnable(pElement->getAttribute(wsEnable));
	bool_ bEnble = (0 == strcmp(sEnable, "true")) ? true_v : false_v;
	
	COptEnable *pOpt = new COptEnable(sName, bEnble);

	if (false_v == Program.AddOperator(pOpt))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
예제 #2
0
ret_ CXMLLoaderActions::LoadAddItem(CProgram &Program,
									const DOMElement *pElement,
									const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

	auto_xerces_str wsName("name");
	auto_xerces_str sName(pElement->getAttribute(wsName));
	
	// Check if there is the container
	if (!m_pTmpContainer)
		return XML_LOADER_ERROR;

	// Check if there is the table identified by the attribute
	CWindow *pWindow = m_pTmpContainer->GetChild(sName);

	if (!pWindow || WINDOW_TABLE != pWindow->Type())
		return XML_LOADER_ERROR;

	COptAddItem *pOpt = new COptAddItem(sName);

	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	while (pSub)
	{
		CVariable *pV = null_v;
		ret_ Ret = LoadVariable(Program.Data(),
								pSub,
								pV,
								pPDU);

		if (SUCCESS != Ret && XML_INVALID_ELEMENT != Ret)
			return Ret;

		if (SUCCESS == Ret)
			pOpt->AddVariable(pV);
		
		pSub = (DOMElement *)pSub->getNextSibling();
	}

	if (false_v == Program.AddOperator(pOpt))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
예제 #3
0
ret_ CXMLLoaderActions::LoadShowWindow(CProgram &Program,
									   const DOMElement *pElement)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

	auto_xerces_str wsName("name");
	auto_xerces_str sName(pElement->getAttribute(wsName));
	
	// Check if there is the container identified by the attribute
	if (!CUIManager::Instance()->GetContainer(sName))
		return XML_LOADER_ERROR;
	
	COptShowWindow *pOpt = new COptShowWindow(sName);

	if (false_v == Program.AddOperator(pOpt))
		return XML_LOADER_ERROR;
	
	return SUCCESS;
}
예제 #4
0
ret_ CXMLLoaderActions::LoadInterfaceVariable(const CData &Data,
											  const DOMElement *pElement,
											  CVariable *&pOV)
{
#ifdef _DEBUG_
	if (!pElement)
		return PARAMETER_NULL | PARAMETER_2;

	if (pOV)
		return PARAMETER_NOT_NULL | PARAMETER_3;
#endif

	auto_xerces_str	wsName("name");
	auto_xerces_str	sName(pElement->getAttribute(wsName));

	// The corresponding widnow should be loaded already
	if (!m_pTmpContainer->GetChild(sName))
		return XML_LOADER_ERROR;

	pOV = new CVarInterface((const ch_1 *)sName);
	
	return SUCCESS;
}
예제 #5
0
IEtsTraderGroupAtomPtr CEtsTraderGroupColl::AddNew(long lID, _bstr_t bsName, _bstr_t bsDescription , CComObject<CEtsTraderGroupAtom>** pAtom )
{
	IEtsTraderGroupAtomPtr spRetVal;
	CComObject<CEtsTraderGroupAtom>* pNewVal;

	_CHK(CComObject<CEtsTraderGroupAtom>::CreateInstance(&pNewVal), _T("Fail to add trader group."));
	spRetVal.Attach(pNewVal,TRUE);

	if(FAILED(IEtsTraderGroupCollImpl::Add(lID, bsName, pNewVal)))
		EgLib::CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Fail to add trader."));
	
	CStringW wsName((BSTR)bsName);
	wsName.Trim();

	pNewVal->m_nID = lID;
	pNewVal->m_bstrDesc = bsDescription;
	pNewVal->m_bstrName =  wsName;

	if(pAtom)
		*pAtom = pNewVal; 
	return spRetVal;

}
예제 #6
0
ret_ CXMLLoaderActions::LoadSolidVariable(const CData &Data,
										  const DOMElement *pElement,
										  CVariable *&pOV)
{
#ifdef _DEBUG_
	if (!pElement)
		return PARAMETER_NULL | PARAMETER_2;

	if (pOV)
		return PARAMETER_NOT_NULL | PARAMETER_3;
#endif

	auto_xerces_str	wsName("name");
	auto_xerces_str	sName(pElement->getAttribute(wsName));

	v_ *pV = Data.Value(sName);

	if (!pV)
		return XML_LOADER_ERROR;

	pOV = new CVarSolidDefined((const ch_1 *)sName);

	return SUCCESS;
}
예제 #7
0
ret_ CXMLLoaderActions::LoadProcessor(const DOMElement *pElement)
{
#ifdef _DEBUG_
	if (!pElement)
		return PARAMETER_NULL | PARAMETER_2;
#endif

	//
	auto_xerces_str	wsName("name");
	auto_xerces_str wsPDU("pdu");
	auto_xerces_str sName(pElement->getAttribute(wsName));

	auto_xerces_str wsDataBlock("data_block");
	auto_xerces_str wsStart("start");
	auto_xerces_str wsOnClick("on_click");
	auto_xerces_str wsOnMessage("on_message");
	auto_xerces_str wsEnd("end");

	m_pTmpContainer = CUIManager::Instance()->GetContainer(sName);
	
	// Check if there is corresponding container, it should be exist
	if (!m_pTmpContainer)
		return XML_LOADER_ERROR;

	CProtocolInfo *pProtocol = CProtocolManager::Instance()->GetProtocol();

	// Protocol should be loaded
	if (!pProtocol)
		return XML_LOADER_ERROR;

	//
	DOMElement *pChild = (DOMElement *)pElement->getFirstChild();

	if (!pChild)
		return XML_LOADER_ERROR;

	while (pChild)
	{
		if (0 == XMLString::compareString(pChild->getNodeName(),
										  wsDataBlock))
		{
			if (SUCCESS != LoadDataBlock(m_pTmpContainer->Data(), pChild))
				return XML_LOADER_ERROR;

			m_pTmpContainer->Data().SetParent(&CUIManager::Instance()->Data());
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsStart))
		{
			if (SUCCESS != LoadProgram(&m_pTmpContainer->Data(),
									   m_pTmpContainer->StartProgram(),
									   pChild))
			{
				return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsOnClick))
		{
			auto_xerces_str sName(pChild->getAttribute(wsName));

			CProgram *pProgram = null_v;

			if (!m_pTmpContainer->AddOnClickProcessor(sName, pProgram))
				return XML_LOADER_ERROR;

			if (SUCCESS != LoadProgram(&m_pTmpContainer->Data(),
									   *pProgram,
									   pChild))
			{
				return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsOnMessage))
		{
			auto_xerces_str sPDU(pChild->getAttribute(wsPDU));

			CPDUInfo *pPDUInfo = null_v;

			if (SUCCESS != pProtocol->GetPDU(sPDU, pPDUInfo))
				return XML_LOADER_ERROR;

			CProgram *pProgram = null_v;

			if (!m_pTmpContainer->AddMessageProcessor(sPDU, pProgram))
				return XML_LOADER_ERROR;

			if (SUCCESS != LoadProgram(&m_pTmpContainer->Data(),
									   *pProgram,
									   pChild,
									   pPDUInfo))
			{
				return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsEnd))
		{
			if (SUCCESS != LoadProgram(&m_pTmpContainer->Data(),
									   m_pTmpContainer->EndProgram(),
									   pChild))
			{
				return XML_LOADER_ERROR;
			}
		}

		pChild = (DOMElement *)pChild->getNextSibling();
	}

	return SUCCESS;
}
예제 #8
0
ret_ CXMLLoaderActions::LoadDataBlock(CData &Data,
									  const DOMElement *pElement)
{
#ifdef _DEBUG_
	if (!pElement)
		return PARAMETER_NULL | PARAMETER_2;
#endif

	DOMElement *pChild = (DOMElement *)pElement->getFirstChild();

	if (!pChild)
		return XML_LOADER_ERROR;

	auto_xerces_str	wsObject	("v_object");
	auto_xerces_str wsB1		("v_b_1");
	auto_xerces_str wsUB1		("v_ub_1");
	auto_xerces_str wsB2		("v_b_2");
	auto_xerces_str wsUB2		("v_ub_2");
	auto_xerces_str wsB4		("v_b_4");
	auto_xerces_str wsUB4		("v_ub_4");
	auto_xerces_str wsB8		("v_b_8");
	auto_xerces_str wsUB8		("v_ub_8");
	auto_xerces_str wsFB4		("v_fb_4");
	auto_xerces_str wsFB8		("v_fb_8");
	auto_xerces_str	wsString	("v_string");
	auto_xerces_str wsGroup		("v_group");

	auto_xerces_str	wsName		("name");
	auto_xerces_str	wsValue		("value");

	while (pChild)
	{
		if (0 == XMLString::compareString(pChild->getNodeName(), wsObject))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (false_v == Data.Define(sName, (obj_)null_v))
				return XML_LOADER_ERROR;
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsB1))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, B_1))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, B_1, (b_4)atoi(sValue)))
					return XML_LOADER_ERROR;
			}

		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsUB1))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, UB_1))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, UB_1, (b_4)atoi(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsB2))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, B_2))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, B_2, (b_4)atoi(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsUB2))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, UB_2))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, UB_2, (b_4)atoi(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsB4))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, B_4))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, B_4, (b_4)atoi(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsUB4))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, UB_4))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, UB_4, (b_4)atoi(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsB8))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, B_8))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, B_8, (b_8)atoll(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsUB8))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, UB_8))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, UB_8, (ub_8)atoll(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsFB4))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, FB_4))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, (fb_4)atof(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsFB8))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, FB_8))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, (fb_8)atof(sValue)))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsString))
		{
			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sValue	(pChild->getAttribute(wsValue));

			if (0 == strcmp(sValue, SIGN_UNBOUNDED))
			{
				if (false_v == Data.Define(sName, (ch_1 *)""))
					return XML_LOADER_ERROR;
			}
			else
			{
				if (false_v == Data.Define(sName, sValue))
					return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(), wsGroup))
		{
			auto_xerces_str wsNormal("normal");
			auto_xerces_str wsFloat	("float");
			auto_xerces_str wsString("string");

			auto_xerces_str	wsName	("name");
			auto_xerces_str	wsLength("length");
			auto_xerces_str	wsSigned("signed");
			auto_xerces_str	wsSize	("size");

			auto_xerces_str sName	(pChild->getAttribute(wsName));
			auto_xerces_str sSize	(pChild->getAttribute(wsSize));

			CFieldGroupDefined *pGroupField = new CFieldGroupDefined(
				sName, 
				sSize);

			DOMElement *pSub = (DOMElement *)pChild->getFirstChild();

			if (!pSub)
				return XML_LOADER_ERROR;

			while (pSub)
			{
				if (0 == XMLString::compareString(pSub->getNodeName(),
												  wsNormal))
				{
					auto_xerces_str sName (pElement->getAttribute(wsName));
					auto_xerces_str	sLength(pElement->getAttribute(wsLength));
					auto_xerces_str	sSigned(pElement->getAttribute(wsSigned));

					EFieldType Type;

					GetFieldType(
						FIELD_NORMAL_STYLE, 
						atoi(sLength), 
						0 == strcmp(sSigned, "true") ? true_v : false_v,
						Type);
					
					CFieldNumber *pField = new CFieldNumber(sName, 
															Type, 
															pGroupField);

					pGroupField->SetSubField(pField);
				}
				else if (0 == XMLString::compareString(pSub->getNodeName(),
													   wsFloat))
				{
					auto_xerces_str sName (pElement->getAttribute(wsName));
					auto_xerces_str	sLength(pElement->getAttribute(wsLength));

					EFieldType Type;

					GetFieldType(FIELD_FLOAT_STYLE, 
								 atoi(sLength), 
								 false_v, 
								 Type);
					
					CFieldNumber *pField = new CFieldNumber(sName, 
															Type, 
															pGroupField);

					pGroupField->SetSubField(pField);
				}
				else if (0 == XMLString::compareString(pSub->getNodeName(),
													   wsString))
				{
					auto_xerces_str sName (pElement->getAttribute(wsName));
					auto_xerces_str	sLength(pElement->getAttribute(wsLength));
					auto_xerces_str	sSize(pElement->getAttribute(wsSize));
					
					CFieldString *pField = new CFieldString(sName, 
															atoi(sSize), 
															pGroupField);

					pGroupField->SetSubField(pField);
				}

				pSub = (DOMElement *)pSub->getNextSibling();
			}
			
			if (false_v == Data.Define(pGroupField))
				return XML_LOADER_ERROR;
		}

		pChild = (DOMElement *)pChild->getNextSibling();
	}

	return SUCCESS;
}
예제 #9
0
ret_ CXMLLoaderNetwork::Load(XercesDOMParser *pParser,
							 const ch_1 *pszEnvironmentPath)
{
	_START(LOAD);

#ifdef _DEBUG_
	if (!pParser)
		_RET(PARAMETER_NULL | PARAMETER_1);

	if (!pszEnvironmentPath)
		_RET(PARAMETER_NULL | PARAMETER_2);

	if (null_v == pszEnvironmentPath[0])
		_RET(PARAMETER_EMPTY | PARAMETER_2);
#endif

	SetParser(pParser);

	ch_1 sNetwork[ENVIRONMENT_PATH_LENGTH];

	memset(sNetwork, 0, ENVIRONMENT_PATH_LENGTH);
	strncpy(sNetwork, pszEnvironmentPath, ENVIRONMENT_PATH_LENGTH);
	strncat(sNetwork, NETWORK_XML_FILE, ENVIRONMENT_PATH_LENGTH);

	DOMDocument *pNetworkDoc = null_v;

	try
	{
		GetParser()->parse(sNetwork);
        pNetworkDoc = GetParser()->getDocument();
	}
    catch (const OutOfMemoryException &err)
    {
		auto_xerces_str sErr(err.getMessage());

		printf("%s\n", (const ch_1 *)sErr);

 		_RET(XML_LOADER_ERROR);
    }
	catch (const XMLException &err)
    {
		auto_xerces_str sErr(err.getMessage());

		printf("%s\n", (const ch_1 *)sErr);

 		_RET(XML_LOADER_ERROR);
	}
    catch (const DOMException &err)
    {
        auto_xerces_str sErr(err.getMessage());

		printf("%s\n", (const ch_1 *)sErr);

 		_RET(XML_LOADER_ERROR);
	}
	catch (...)
    {
		printf("Unexpected error during parsing.\n");

		_RET(XML_LOADER_ERROR);
    }

	DOMElement *pRoot = pNetworkDoc->getDocumentElement();

	if (!pRoot)
		_RET(XML_LOADER_ERROR);

	DOMElement *pChild = (DOMElement *)pRoot->getFirstChild();

	if (!pChild)
		_RET(XML_LOADER_ERROR);

	auto_xerces_str wsIdentity		("identity");
	auto_xerces_str wsPDU			("pdu");
	auto_xerces_str wsDirection		("direction");
	auto_xerces_str	wsName			("name");
	auto_xerces_str	wsProtocolName	("protocol");
	auto_xerces_str wsCommandID		("command_id");
	auto_xerces_str wsSizeID		("size_id");
	auto_xerces_str	wsLocalPort		("local_port");
	auto_xerces_str wsAuto			("auto");

	auto_xerces_str wsFilter		("filter");
	auto_xerces_str wsMaxConnections("max_connections");
	auto_xerces_str wsRemoteIP		("remote_ip");
	auto_xerces_str	wsRemotePort	("remote_port");
	auto_xerces_str wsReconnect		("reconnect");

	auto_xerces_str wsAcceptorName	("acceptor");
	auto_xerces_str	wsConnectorName	("connector");
 	auto_xerces_str wsReceiverName	("receiver");
	auto_xerces_str wsSenderName	("sender");

	auto_xerces_str wsType			("type");


	while (pChild)
    {
		ENetworkType NetworkType = NETWORK_NONE;
		CProtocolInfo *pProtocol = null_v;
		CField *pCommandIDField	= null_v;
		CField *pSizeIDField = null_v;
		bool_ bIsAutoStart = true_v;

		if (0 == XMLString::compareString(pChild->getNodeName(),
										  wsAcceptorName))
		{
			NetworkType = NETWORK_ACCEPTOR;
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsConnectorName))
		{
			NetworkType = NETWORK_CONNECTOR;
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsReceiverName))
		{
			NetworkType = NETWORK_RECEIVER;
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsSenderName))
		{
			NetworkType = NETWORK_SENDER;
		}
		else
		{
			pChild = (DOMElement *)pChild->getNextSibling();

			continue;
		}

		auto_xerces_str sProtocolName(pChild->getAttribute(wsProtocolName));

		if (SUCCESS != _ERR(
				CXMLLoaderProtocol::Instance()->Load(pParser,
													 pszEnvironmentPath,
													 sProtocolName)))
		{
			_RET(XML_LOADER_ERROR);
		}

		//
		if (SUCCESS != _ERR(
                CProtocolManager::instance()->getProtocol(sProtocolName,
                        pProtocol)))
		{
			_RET(XML_LOADER_ERROR);
		}

		//
		auto_xerces_str sCommandID(pChild->getAttribute(wsCommandID));

        if (SUCCESS != _ERR(pProtocol->getHeadField(sCommandID,
                pCommandIDField))
			|| FIELD_NORMAL_STYLE !=
                (pCommandIDField->type() & FIELD_NORMAL_STYLE)
                || 4 < _LEN(pCommandIDField->type()))
		{
			_RET(XML_LOADER_ERROR);
		}

		//
		auto_xerces_str sSizeID(pChild->getAttribute(wsSizeID));

        if (SUCCESS != _ERR(pProtocol->getHeadField(sSizeID,
                pSizeIDField))
			|| FIELD_NORMAL_STYLE !=
                (pSizeIDField->type() & FIELD_NORMAL_STYLE)
                || 4 < _LEN(pSizeIDField->type()))
		{
			_RET(XML_LOADER_ERROR);
		}

		//
		auto_xerces_str wsAutoFalse("false");

		if (0 == XMLString::compareString(wsAutoFalse,
										  pChild->getAttribute(wsAuto)))
		{
			bIsAutoStart = false_v;
		}

        CNode *pNetwork = null_v;
		auto_xerces_str sName(pChild->getAttribute(wsName));

		switch (NetworkType)
		{
		case NETWORK_NONE:
			_RET(XML_LOADER_ERROR);
		case NETWORK_ACCEPTOR:
			{
				auto_xerces_str	sLocalPort(pChild->getAttribute(wsLocalPort));
				auto_xerces_str
					sMaxConnections(pChild->getAttribute(wsMaxConnections));

				pNetwork = new CAcceptor(pProtocol,
										 pCommandIDField,
										 pSizeIDField,
										 (ub_2)atoi(sLocalPort),
										 (size_)atoi(sMaxConnections),
										 bIsAutoStart);
			}

			break;
		case NETWORK_CONNECTOR:
			{
				//
				auto_xerces_str	nLocalPort	(pChild->getAttribute(wsLocalPort));
				auto_xerces_str	sRemoteIP	(pChild->getAttribute(wsRemoteIP));
				auto_xerces_str	nRemotePort
					(pChild->getAttribute(wsRemotePort));
				auto_xerces_str	sReconnect	(pChild->getAttribute(wsReconnect));

				pNetwork = new CConnector(pProtocol,
										  pCommandIDField,
										  pSizeIDField,
										  (ub_2)atoi(nLocalPort),
										  (const ch_1 *)sRemoteIP,
										  (ub_2)atoi(nRemotePort),
										  (b_4)atoi(sReconnect),
										  bIsAutoStart);
			}

			break;
		case NETWORK_RECEIVER:
			{
				//
				auto_xerces_str sLocalPort(pChild->getAttribute(wsLocalPort));


				pNetwork = new CReceiver(pProtocol,
										 pCommandIDField,
										 pSizeIDField,
										 (ub_2)atoi(sLocalPort),
										 bIsAutoStart);
			}

			break;
		case NETWORK_SENDER:
			{
				//
				auto_xerces_str sLocalPort(pChild->getAttribute(wsLocalPort));

				pNetwork = new CSender(pProtocol,
									   pCommandIDField,
									   pSizeIDField,
									   (ub_2)atoi(sLocalPort),
									   bIsAutoStart);
			}
		}

        CNodeConf *pNetworkConf = (CNodeConf *) pNetwork->getConf();

		//
		DOMElement *pSub = (DOMElement *)pChild->getFirstChild();

		if (!pSub)
			_RET(XML_LOADER_ERROR);

		while (pSub)
		{
			if (0 == XMLString::compareString(pSub->getNodeName(),
											  wsIdentity))
			{
				//
				auto_xerces_str sIdentity(pSub->getAttribute(wsIdentity));
				ch_1 			*sIdentityName = null_v;

				if (SUCCESS != _ERR(GetLastName(sIdentity, sIdentityName)))
					_RET(XML_LOADER_ERROR);

                v_ *pV = pProtocol->data().value(sIdentityName);

				if (!pV)
					_RET(XML_LOADER_ERROR);

				//
				auto_xerces_str	sPDU(pSub->getAttribute(wsPDU));
                CPduInfo *pPDU = null_v;

                if (SUCCESS != _ERR(pProtocol->getPdu(sPDU, pPDU)))
					_RET(XML_LOADER_ERROR);

				//
				auto_xerces_str sDirection(pSub->getAttribute(wsDirection));
				EDirection		Direction;

				if (SUCCESS != _ERR(GetDirection(sDirection, Direction)))
					_RET(XML_LOADER_ERROR);

				//
				if (SUCCESS != _ERR(pNetworkConf->ConfigPDU(*pV,
															pPDU,
															Direction)))
				{
					_RET(XML_LOADER_ERROR);
				}
			}
			else if (0 == XMLString::compareString(pSub->getNodeName(),
												   wsFilter))
			{
				CIPFilter *pIPFilter = null_v;

				if (NETWORK_ACCEPTOR == NetworkType)
				{
					pIPFilter =
						&((CAcceptorConf *)pNetworkConf)->IPFilter();
				}
				else if (NETWORK_RECEIVER == NetworkType)
				{
					pIPFilter =
						&((CReceiverConf *)pNetworkConf)->IPFilter();
				}
				else
				{
					_RET(XML_LOADER_ERROR);
				}

				auto_xerces_str sType(pSub->getAttribute(wsType));

				if (0 == strcmp(sType, "forbid")) {
                    pIPFilter->setForbid(true_v);
                } else if (0 == strcmp(sType, "permit")) {
                    pIPFilter->setForbid(false_v);
                }

                auto_xerces_str sIPGroup(pSub->getTextContent());

                if (false_v == pIPFilter->addIpGroup((const ch_1 *) sIPGroup))
					_RET(XML_LOADER_ERROR);
			}

			pSub = (DOMElement *)pSub->getNextSibling();
		}

        if (SUCCESS != _ERR(CNetworkManager::instance()->AddNetwork(
														(const char *)sName,
														NetworkType,
														pNetwork)))
		{
			_RET(XML_LOADER_ERROR);
		}

		pChild = (DOMElement *)pChild->getNextSibling();
	}

	_RET(SUCCESS);
}