Ejemplo n.º 1
0
BOOL WXmlParse::readExtendModName(std::vector<std::pair<string, string> > &modNames)
{
	MSXML2::IXMLDOMDocumentPtr doc;
	MSXML2::IXMLDOMElementPtr docRoot;  
	MSXML2::IXMLDOMElementPtr docElement;  
	MSXML2::IXMLDOMNodeListPtr elementNodes;  
	MSXML2::IXMLDOMNamedNodeMapPtr elementAttributes;
	MSXML2::IXMLDOMNodePtr xmlNode;  
	MSXML2::IXMLDOMNodePtr xmlSubNode; 
	MSXML2::IXMLDOMNodePtr xmlAttrNode; 
	doc.CreateInstance(__uuidof(DOMDocument30));  
	doc->load((_variant_t)m_strFileName);

	docRoot = doc->GetdocumentElement();//获得根节点;  
	docRoot->get_childNodes(&elementNodes);  
	LONG length, subLength, attrLength;
	elementNodes->get_length(&length);
	MSXML2::IXMLDOMNodeListPtr subElementNodes; 

	// 3 :  扩展模块列表
	elementNodes->get_item(1, &xmlNode);
	xmlNode->get_childNodes(&subElementNodes);
	subElementNodes->get_length(&subLength);
	for (int j = 0; j < subLength;j++)
	{
		subElementNodes->get_item(j, &xmlSubNode);//获得某个属性
		xmlSubNode->get_attributes(&elementAttributes);
		MSXML2::IXMLDOMNodePtr nameNode = elementAttributes->getNamedItem("name");
		MSXML2::IXMLDOMNodePtr descNode = elementAttributes->getNamedItem("description");
		modNames.push_back(std::make_pair(nameNode->text, descNode->text));
	}

	return TRUE;
}
Ejemplo n.º 2
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CVerifyResponse
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CVerifyResponse::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
    CVerifyEntity::GetData(pIDomNode);
    _bstr_t bstrNodeName = def_STR_VERIFYMSG_NODE;
    CComVariant NodeValue;
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMVerifyAtrributes;
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;
    pDOMVerifyAtrributes = pIDomNode->Getattributes();
    //bstrNodeName = def_STR_ATTRIB_WAITFOR;
    bstrNodeName.Assign(SysAllocString(CT2W(def_STR_ATTRIB_WAITFOR)));
    pIDOMChildNode = pDOMVerifyAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
    CString strTemp;
    strTemp = strCopyBSTRToCString(NodeValue);
    //W4 Removal
    m_ushDuration = (USHORT)atoi((LPCSTR)strTemp);
    INT nCount = (INT)m_ouData.m_odVerify_MessageEntityList.GetCount();

    for(int i = 0; i < nCount; i++)
    {
        CVerify_MessageData ouVerifyData;
        POSITION pos = m_ouData.m_odVerify_MessageEntityList.FindIndex(i);
        CVerify_MessageEntity& ouVerifyEntity = m_ouData.m_odVerify_MessageEntityList.GetAt(pos);
        ouVerifyEntity.GetEntityData(VERIFY_MESSAGE, &ouVerifyData);
        m_ouVerifyMsgMap[ouVerifyData.m_dwMessageID] = ouVerifyData;
    }

    return S_OK;
}
Ejemplo n.º 3
0
/******************************************************************************
Function Name  :  nParseTSFile
Input(s)       :  CString omstrTSFile
Output         :  INT
Functionality  :  Load the omStrTSFille
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
Codetag        : CS002
******************************************************************************/
INT CTestSetupEntity::nParseTSFile(CString omstrTSFile)
{
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    HRESULT hr = pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");

    if ( FAILED(hr) )
    {
        throw "Unable to create XML parser object";
    }

    if(PathFileExists(omstrTSFile) == FALSE)
    {
        return ERR_PATH_INCORRECT;
    }

    //Create A TestSetup DOM document
    CComVariant varFileName((LPCSTR)omstrTSFile);

    try
    {
        pIDOMDoc->load(varFileName);
        //GetTest Setup Title
        MSXML2::IXMLDOMNodePtr pIDOMTiltleNode;
        _bstr_t bstrNodeName = def_STR_TSNODE_NAME;
        CComVariant NodeValue;
        pIDOMTiltleNode = pIDOMDoc->selectSingleNode(bstrNodeName);
        MSXML2::IXMLDOMNamedNodeMapPtr pDOMTCAtrributes;
        pDOMTCAtrributes = pIDOMTiltleNode->Getattributes();
        MSXML2::IXMLDOMNodePtr pIDOMChildNode;
        //bstrNodeName = def_STR_TSATTRIB_TITLE;
        bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSATTRIB_TITLE)));
        pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
        pIDOMChildNode->get_nodeTypedValue(&NodeValue);
        m_omstrTestSetupTitle = strCopyBSTRToCString(NodeValue);
        pIDOMChildNode.Release();
        //Get Description
        //bstrNodeName = def_STR_TSDESCRIPTION;
        bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSDESCRIPTION)));
        MSXML2::IXMLDOMNodePtr pIDOMDescriptionNode = pIDOMDoc->selectSingleNode(bstrNodeName);
        pIDOMDescriptionNode->get_nodeTypedValue(&NodeValue);
        m_omstrDescription = strCopyBSTRToCString(NodeValue);
        //Get Header Node
        //bstrNodeName = def_STR_TSHEADER;
        bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSHEADER)));
        MSXML2::IXMLDOMNodePtr pIDOMHeaderNode = pIDOMDoc->selectSingleNode(bstrNodeName);
        nLoadHeader(pIDOMHeaderNode);
        pIDOMHeaderNode.Release();
        //Get TestCases List
        //bstrNodeName = def_STR_TSTCLIST;
        bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSTCLIST)));
        MSXML2::IXMLDOMNodePtr pIDOMTSNode = pIDOMDoc->selectSingleNode(bstrNodeName);
        GetData(pIDOMTSNode);
    }
    catch(...)
    {
        return S_FALSE;
    }

    return S_OK;
}
Ejemplo n.º 4
0
	void readVerticesNormalsTexcoords(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
	{
		MSXML2::IXMLDOMNodeListPtr sourceList = mesh->selectNodes("r:source");
		vector<float> vertices;
		vector<float> normals;
		vector<float> texcoords;

		for (int i = 0; i < sourceList->length; i++)
		{
			MSXML2::IXMLDOMNodePtr source = sourceList->Getitem(i);
			MSXML2::IXMLDOMNamedNodeMapPtr attributes = source->attributes;

			for (int j = 0; j < attributes->length; j++)
			{
				_bstr_t attributeName = attributes->getNamedItem("id")->text;

				if (wcsstr(_wcslwr(attributeName), L"position"))
				{
					geometry.vertices = readArray<float>(source);
				} else if (wcsstr(_wcslwr(attributeName), L"normal"))
				{
					geometry.normals = readArray<float>(source);
				} else if (wcsstr(_wcslwr(attributeName), L"map") ||	// belnder
						   wcsstr(_wcslwr(attributeName), L"-uv"))		// 3dsmax
				{
					geometry.texcoords = readArray<float>(source);
				}
			}
		}
	}
Ejemplo n.º 5
0
BOOL WXmlParse::readObject(ExternalObject *objRet, MSXML2::IXMLDOMNodePtr &xmlSubNode)
{
	MSXML2::IXMLDOMNamedNodeMapPtr elementAttributes;
	MSXML2::IXMLDOMNodeListPtr subElementNodes; 
	MSXML2::IXMLDOMNodeListPtr subSubElementNodes; 
	MSXML2::IXMLDOMNodePtr xmlNodeTmp; 
	xmlSubNode->get_attributes(&elementAttributes);

	LONG attrLength;
	attrLength = elementAttributes->Getlength();
	MSXML2::IXMLDOMNodePtr nameNode = elementAttributes->getNamedItem("name");
	MSXML2::IXMLDOMNodePtr clsNode = elementAttributes->getNamedItem("type");
	objRet->objName = nameNode->text;
	objRet->clsName = clsNode->text;
	LONG length, subLength;
	xmlSubNode->get_childNodes(&subElementNodes);
	subElementNodes->get_length(&length);
	objRet->attri.clear();

	for (int i = 0;i < length;i++)
	{
		subElementNodes->get_item(i, &xmlNodeTmp);
		string childName = xmlNodeTmp->nodeName;
		if (strcmp(xmlNodeTmp->nodeName,"child") != 0)
		{
			xmlNodeTmp->get_attributes(&elementAttributes);
			if (!elementAttributes)
				return FALSE;
			MSXML2::IXMLDOMNodePtr typeNode = elementAttributes->getNamedItem("type");
			objRet->attri.push_back(std::make_pair(xmlNodeTmp->nodeName, std::make_pair(typeNode->text, xmlNodeTmp->text)));
		}
		else
		{
			xmlNodeTmp->get_childNodes(&subSubElementNodes);
			subSubElementNodes->get_length(&subLength);
			for (int j = 0;j < subLength;j++)
			{
				ExternalObject *objSub = new ExternalObject();
				subSubElementNodes->get_item(j, &xmlNodeTmp);
				readObject(objSub, xmlNodeTmp);
				objRet->children.push_back(objSub);
			}
		}
	}

	return TRUE;
}
Ejemplo n.º 6
0
BOOL WXmlParse::readCalculateParams(WCalcaulateParam &calParam)
{
	MSXML2::IXMLDOMDocumentPtr doc;
	MSXML2::IXMLDOMElementPtr docRoot;  
	MSXML2::IXMLDOMElementPtr docElement;  
	MSXML2::IXMLDOMNodeListPtr elementNodes;  
	MSXML2::IXMLDOMNamedNodeMapPtr elementAttributes;
	MSXML2::IXMLDOMNodePtr xmlNode;  
	MSXML2::IXMLDOMNodePtr xmlSubNode; 
	MSXML2::IXMLDOMNodePtr xmlAttrNode; 
	doc.CreateInstance(__uuidof(DOMDocument30));  
	if (m_strFileName.IsEmpty())
	{
		return FALSE;
	}
	doc->load((_variant_t)m_strFileName);

	docRoot = doc->GetdocumentElement();//获得根节点;  
	docRoot->get_childNodes(&elementNodes);  
	LONG length, subLength, attrLength;
	elementNodes->get_length(&length);
	MSXML2::IXMLDOMNodeListPtr subElementNodes; 

	// 0 : 
	elementNodes->get_item(2, &xmlNode);
	xmlNode->get_childNodes(&subElementNodes);
	subElementNodes->get_length(&subLength);
	for (int j = 0; j < subLength;j++)
	{
		subElementNodes->get_item(j, &xmlSubNode);//获得某个属性
		xmlSubNode->get_attributes(&elementAttributes); 
		MSXML2::IXMLDOMNodePtr proNode = elementAttributes->getNamedItem("name");
		string proName = proNode->text;
		MSXML2::IXMLDOMNodeListPtr subAttrNodes; 
		xmlSubNode->get_childNodes(&subAttrNodes);
		subAttrNodes->get_length(&attrLength);
//		ASSERT(attrLength == 2);

		MSXML2::IXMLDOMNodePtr descNode;
		MSXML2::IXMLDOMNodePtr stateNode;
		subAttrNodes->get_item(0, &descNode);
		subAttrNodes->get_item(1, &stateNode);
		std::vector<string> vecParam;
		string descText = descNode->text;
		string stateText = stateNode->text;
		vecParam.push_back(proName);
		vecParam.push_back(descText);
		vecParam.push_back(stateText);

		calParam.addParam(vecParam);
	}

	return TRUE;
}
Ejemplo n.º 7
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CVerifyEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CVerifyEntity::GetCommonVerifyData(MSXML2::IXMLDOMNodePtr& pIDomNode, CVerifyData *verifyData)
{
	m_ouData = verifyData;
    _bstr_t bstrNodeName = def_STR_VERIFYMSG_NODE;
    CComVariant NodeValue;
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMVerifyAtrributes;
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    pDOMVerifyAtrributes = pIDomNode->Getattributes();
    //bstrNodeName = L"failure";
    bstrNodeName.Assign(SysAllocString(CT2W("failure")));
    pIDOMChildNode = pDOMVerifyAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
    CString strTemp;
    strTemp = strCopyBSTRToCString(NodeValue);

	//m_ouData = new CVerifyData();
    if(strTemp == "SUCCESS")
    {
        m_ouData->m_eAttributeError = SUCCESS;
    }
    else if(strTemp == "WARNING")
    {
        m_ouData->m_eAttributeError = WARNING;
    }
    else if(strTemp == "ERRORS")
    {
        m_ouData->m_eAttributeError = ERRORS;
    }
    else
    {
        m_ouData->m_eAttributeError = FATAL;
    }
    MSXML2::IXMLDOMNodeListPtr pIDOMSendList;

    LONG lCount;
    //bstrNodeName = def_STR_VERIFYMSG_NODE;
    bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VERIFYMSG_NODE)));
    pIDOMSendList = pIDomNode->selectNodes(bstrNodeName);
    pIDOMSendList->get_length(&lCount);

    for(int i = 0; i < lCount; i++)
    {
        CVerifySubEntity *odVerifySubEntity;
        MSXML2::IXMLDOMNodePtr pIXMLDOMVerifyMsgEntity;
        pIXMLDOMVerifyMsgEntity = pIDOMSendList->Getitem(i);
		//if(CVerifySubEntity::GetData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
		if(this->GetSubEntityData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
        {
            m_ouData->m_odVerifySubEntityList.push_back(odVerifySubEntity);
        }
    }
    return S_OK;
}
Ejemplo n.º 8
0
////////////////////////////////////////////////////////////////////////////
// Helper function:
////////////////////////////////////////////////////////////////////////////
CString CXMLDocument::GetStringValue(LPCSTR szAttrib, MSXML2::IXMLDOMNode* pNode)
{
	CComBSTR bstrValue;
	MSXML2::IXMLDOMNamedNodeMapPtr pAttributes;
	MSXML2::IXMLDOMNodePtr pItemNode;

	if (SUCCEEDED(pNode->get_attributes(&pAttributes)) && (pAttributes != NULL))
		pAttributes->getNamedItem(CComBSTR(szAttrib), &pItemNode);
	if (pItemNode)
		pItemNode->get_text(&bstrValue);

	return CString(bstrValue);
}
Ejemplo n.º 9
0
	void readTriangles(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
	{
		MSXML2::IXMLDOMNodeListPtr polyLists = mesh->selectNodes("r:polylist"); // blender
		MSXML2::IXMLDOMNodePtr p;

		if (polyLists->length == 0)
			polyLists = mesh->selectNodes("r:triangles"); // 3dsmax

		for (int i = 0; i < polyLists->length; i++)
		{
			MSXML2::IXMLDOMNodePtr polylist = polyLists->item[i];
			MSXML2::IXMLDOMNodePtr p = polylist->selectSingleNode("r:p");
			if (p == NULL) continue;

			geometry.vertexOffset.push_back(-1);
			geometry.normalOffset.push_back(-1);
			geometry.texcoordOffset.push_back(-1);

			MSXML2::IXMLDOMNodeListPtr inputList = polylist->selectNodes("r:input");
			for (int j = 0; j < inputList->length; j++)
			{
				MSXML2::IXMLDOMNodePtr input = inputList->Getitem(j);
				MSXML2::IXMLDOMNamedNodeMapPtr attributes = input->attributes;

				string semantic = (_bstr_t)_wcslwr((wchar_t *)attributes->getNamedItem("semantic")->text);
				int offset = _wtoi(attributes->getNamedItem("offset")->text);

				if (semantic == "vertex")
					geometry.vertexOffset[geometry.vertexOffset.size() - 1] = offset;
				else if (semantic == "normal")
					geometry.normalOffset[geometry.normalOffset.size() - 1] = offset;
				else if (semantic == "texcoord")
					geometry.texcoordOffset[geometry.texcoordOffset.size() - 1] = offset;
			}

			vector<int> v = readValues<int>(p);
			geometry.triangles.push_back(v);
		}
	}
Ejemplo n.º 10
0
BOOL WXmlParse::readParam(std::vector<WParamDefine *> &outParams)
{
	MSXML2::IXMLDOMDocumentPtr doc;
	MSXML2::IXMLDOMElementPtr docRoot;  
	MSXML2::IXMLDOMElementPtr docElement;  
	MSXML2::IXMLDOMNodeListPtr elementNodes;  
	MSXML2::IXMLDOMNamedNodeMapPtr elementAttributes;
	MSXML2::IXMLDOMNodePtr xmlNode;  
	MSXML2::IXMLDOMNodePtr xmlSubNode; 
	MSXML2::IXMLDOMNodePtr xmlAttrNode; 
	doc.CreateInstance(__uuidof(DOMDocument30));  
	if (m_strFileName.IsEmpty())
	{
		return FALSE;
	}
	doc->load((_variant_t)m_strFileName);

	docRoot = doc->GetdocumentElement();//获得根节点;  
	docRoot->get_childNodes(&elementNodes);  
	LONG length, subLength, attrLength;
	elementNodes->get_length(&length);
	MSXML2::IXMLDOMNodeListPtr subElementNodes; 

	// 0 : 
	elementNodes->get_item(0, &xmlNode);
	xmlNode->get_childNodes(&subElementNodes);
	subElementNodes->get_length(&subLength);
	for (int j = 0; j < subLength;j++)
	{
		subElementNodes->get_item(j, &xmlSubNode);//获得某个属性
		xmlSubNode->get_attributes(&elementAttributes); 
		MSXML2::IXMLDOMNodePtr proNode = elementAttributes->getNamedItem("name");
		string proName = proNode->text;
		WParamDefine *paramTest = new WParamDefine(proName);
		MSXML2::IXMLDOMNodeListPtr subAttrNodes;  
		xmlSubNode->get_childNodes(&subAttrNodes);
		subAttrNodes->get_length(&attrLength);
		for (int k = 0;k < attrLength;k++)
		{
			subAttrNodes->get_item(k, &xmlAttrNode);
			string attrName = xmlAttrNode->nodeName;
			string attrText = xmlAttrNode->text;
			paramTest->addValue(attrName, attrText);
		}
		outParams.push_back(paramTest);
	}

	return TRUE;
}
Ejemplo n.º 11
0
bool XmlIOStreamImp::ReadNodeAttribute(const CString& attrName, CString& attrValue)
{
	DATA_ASSERT(mpCurrentNode != NULL);
	if(NULL == mpCurrentNode)
		return false;

	MSXML2::IXMLDOMNamedNodeMapPtr attribs = mpCurrentNode->Getattributes();
	
	MSXML2::IXMLDOMNodePtr pAttr = attribs->getNamedItem((LPCTSTR)attrName);
	if(NULL == pAttr)
		return false;

	attrValue = pAttr->GetnodeValue();
	return true;
}
Ejemplo n.º 12
0
	void readMesh(dae_reader_t *reader, MSXML2::IXMLDOMNodePtr geometry)
	{
		MSXML2::IXMLDOMNodePtr mesh = geometry->selectSingleNode("r:mesh");
		if (mesh == NULL) return;

		geometry_t object;
		MSXML2::IXMLDOMNamedNodeMapPtr attributes = geometry->attributes;
		if (attributes->length > 0)
			object.name = attributes->getNamedItem("name")->text;

		readVerticesNormalsTexcoords(mesh, object);
		readTriangles(mesh, object);

		object.maxIndex = 0;
		reader->geometry.push_back(object);
	}
Ejemplo n.º 13
0
////////////////////////////////////////////////////////////////////////////
// Helper function:
////////////////////////////////////////////////////////////////////////////
CString CXMLDocument::GetStringValue(LPCSTR szNodePattern, LPCSTR szAttrib, MSXML2::IXMLDOMNode* pNode)
{
	CComBSTR strNodePattern(szNodePattern);
	MSXML2::IXMLDOMNodePtr pPatternNode;
	CComBSTR strValue;

	pNode->selectSingleNode(strNodePattern, &pPatternNode);
	if (pPatternNode)
	{
		MSXML2::IXMLDOMNamedNodeMapPtr pAttributes;
		MSXML2::IXMLDOMNodePtr pItemNode;

		if (SUCCEEDED(pPatternNode->get_attributes(&pAttributes)) && (pAttributes != NULL))
			pAttributes->getNamedItem(CComBSTR(szAttrib), &pItemNode);
		if (pItemNode)
			pItemNode->get_text(&strValue);
	}

	return CString(strValue);
}
Ejemplo n.º 14
0
bool CNodeUtil::bReadAttribute(MSXML2::IXMLDOMNode* iNode,
                               std::string& omAttribute, _bstr_t temp)
{
    std::string strTemp;
    bool bResult = false;
    MSXML2::IXMLDOMNamedNodeMapPtr pCodeAttrib;
    MSXML2::IXMLDOMNodePtr iTempNode = nullptr;

    pCodeAttrib = iNode->Getattributes();
    if (pCodeAttrib->Getlength() >= 1)
    {
        iTempNode = pCodeAttrib->getNamedItem(temp);
        if (iTempNode != nullptr)
        {
            omAttribute = _com_util::ConvertBSTRToString(iTempNode->text.GetBSTR());
            bResult = true;
        }
    }
    return bResult;
}
Ejemplo n.º 15
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :  MSXML2::IXMLDOMNodePtr& pIDomNode
Output         :  HRESULT
Functionality  :   
Member of      :  CWaitEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CWaitEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
    _bstr_t bstrNodeName;
    CComVariant NodeValue;	
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMWaitAtrributes;
    pDOMWaitAtrributes = pIDomNode->Getattributes();
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    //bstrNodeName = L"purpose";
	bstrNodeName.Assign(SysAllocString(CT2W("purpose")));
    pIDOMChildNode = pDOMWaitAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omPurpose = strCopyBSTRToCString(NodeValue);
    
    pIDomNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    //W4 Removal - Type Conversion No problem.
    m_ouData.m_ushDuration = (USHORT)atoi((LPCSTR)strTemp);
    pIDOMChildNode.Release();
    pDOMWaitAtrributes.Release();
    return S_OK;
}
Ejemplo n.º 16
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :  MSXML2::IXMLDOMNodePtr& pIDomNode
Output         :  HRESULT
Functionality  :  Fills the datastructure from the XML node 
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CTestCaseEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
//Getting Attributes
    _bstr_t bstrNodeName;
    CComVariant NodeValue;	
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMTCAtrributes;
    pDOMTCAtrributes = pIDomNode->Getattributes();
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    //bstrNodeName = L"identifier";
	bstrNodeName.Assign(SysAllocString(CT2W("identifier")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omID = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();
    
    //bstrNodeName = L"title";
	bstrNodeName.Assign(SysAllocString(CT2W("title")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omTitle = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();

    //bstrNodeName = L"exp_handler";
	bstrNodeName.Assign(SysAllocString(CT2W("exp_handler")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();
    
    if(strTemp == "CONTINUE")
    {
        m_ouData.m_eExcpAction = CONTINUE;
    }
    else
    {
        m_ouData.m_eExcpAction = EXIT;
    }

//Getting Testcases
    MSXML2::IXMLDOMNodeListPtr pDOMChildList = pIDomNode->GetchildNodes();
    LONG lCount;
    pDOMChildList->get_length(&lCount);
    CComBSTR NodeName;
    for(int i = 0;i < lCount; i++)
    {
        pIDOMChildNode = pDOMChildList->Getitem(i);
        pIDOMChildNode->get_nodeName(&NodeName);        
		
        CBaseEntityTA *odpBaseEntity = NULL;
		if(NodeName == def_STR_SEND_NODE)
        {
            odpBaseEntity = new CSendEntity();
        }
        else if(NodeName == def_STR_VERIFY_NODE)
        {
            odpBaseEntity = new CVerifyEntity();
        }
        else if(NodeName == def_STR_WAIT_NODE)
        {
            odpBaseEntity = new CWaitEntity();
        }
        else if(NodeName == def_STR_REPLAY_NODE)
        {
            odpBaseEntity = new CReplayEntity();
        }
        else if(NodeName == def_STR_VERIFYRES_NODE)
        {
            odpBaseEntity = new CVerifyResponse();
        }
        if(odpBaseEntity == NULL)
        {
            //TODO::return a correct value
            return -1;
        }
        odpBaseEntity->GetData(pIDOMChildNode);
        m_ouData.m_odTAEntityList.AddTail(odpBaseEntity);
        //pIDOMChildNode->Release();
    }
    return S_OK;
}