Exemplo n.º 1
0
BOOL WXmlParse::readObject(std::vector<ExternalObject *> &objTree)
{
	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(3, &xmlNode);
	xmlNode->get_childNodes(&subElementNodes);
	subElementNodes->get_length(&subLength);
	for (int j = 0; j < subLength;j++)
	{
		ExternalObject *objTmp = new ExternalObject();
		subElementNodes->get_item(j, &xmlSubNode);//获得某个属性
		xmlSubNode->get_attributes(&elementAttributes);
		readObject(objTmp, xmlSubNode);
		objTree.push_back(objTmp);
	}

	return TRUE;
}
Exemplo n.º 2
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;
}
Exemplo n.º 3
0
//设置指定xpath的节点值
BOOL CXmlBase::SetNodeValue(LPCTSTR lpszValue, MSXML2::IXMLDOMNodePtr pNode)
{
	if (pNode == NULL) return FALSE;
	if (lpszValue == NULL) return FALSE;
	MSXML2::IXMLDOMElementPtr pElem = pNode;
	pElem->Puttext(lpszValue);
	return TRUE;
}
Exemplo n.º 4
0
CStdString SmartTagParser::GetNamespacePrefix()
{
    if (m_spXMLDom == NULL)
    {
        CStdString msg;
        msg.Format(_T("SmartTagParser::GetNamespacePrefix - The XML document pointer is null."));
        throw Workshare::NullReferenceException(msg);
    }

    MSXML2::IXMLDOMElementPtr spElement = m_spXMLDom->firstChild;
    if (spElement == NULL)
    {
        CStdString msg;
        msg.Format(_T("SmartTagParser::GetNamespacePrefix - Failed to get the first node of the document."));
        throw Workshare::Exception(msg);
    }

    MSXML2::IXMLDOMNamedNodeMapPtr spAttributes = spElement->attributes;
    if (spAttributes == NULL)
    {
        spElement.Release();

        CStdString msg;
        msg.Format(_T("SmartTagParser::GetNamespacePrefix - Failed to get attributes of the first child of the document."));
        throw Workshare::Exception(msg);
    }

    MSXML2::IXMLDOMAttributePtr spAttribute = spAttributes->item[0];
    if (spAttribute == NULL)
    {
        spElement.Release();
        spAttributes.Release();

        CStdString msg;
        msg.Format(_T("SmartTagParser::GetNamespacePrefix - Failed to get attributes of the first child of the document."));
        throw Workshare::Exception(msg);
    }

    CStdString sFullNamespace = spAttribute->xml;
	HRESULT hr = m_spXMLDom->raw_setProperty(_T("SelectionNamespaces"), _variant_t(sFullNamespace.c_str()));
	if (FAILED(hr))
	{
		CStdString message;
		message.Format(_T("SmartTagParser::SmartTagParser - Failed to set namespace : %s."), sFullNamespace.c_str());
		throw Workshare::Com::ComException(message.c_str(), hr, m_spXMLDom);
	}

    int iPosStart = sFullNamespace.Find(_T(":"));
    int iPosEnd = sFullNamespace.Find(_T("="));

    CStdString sPrefix = sFullNamespace.Mid(iPosStart+1, iPosEnd - (iPosStart+1));

    spElement.Release();
    spAttributes.Release();
    spAttribute.Release();

    return sPrefix;
}
Exemplo n.º 5
0
static HRESULT CreateStudyNode(DcmDirectoryRecord *studyRec, MSXML2::IXMLDOMElementPtr &patient, MSXML2::IXMLDOMDocumentPtr &pXMLDom)
{
	MSXML2::IXMLDOMElementPtr study = pXMLDom->createNode(MSXML2::NODE_ELEMENT, "Study", "http://www.weasis.org/xsd");
	if(study == NULL) return CO_E_NOT_SUPPORTED;

	const char *buff = NULL, *studyUID = NULL;
	if(studyRec->findAndGetString(DCM_StudyInstanceUID, studyUID).bad()) return CO_E_NOT_SUPPORTED;
	else study->setAttribute("StudyInstanceUID", studyUID);
	if(studyRec->findAndGetString(DCM_StudyDate, buff).bad()) return CO_E_NOT_SUPPORTED;
	else study->setAttribute("StudyDate", buff);
	if(studyRec->findAndGetString(DCM_StudyTime, buff).good()) study->setAttribute("StudyTime", buff);
	if(studyRec->findAndGetString(DCM_StudyID, buff).good()) study->setAttribute("StudyID", buff);
	if(studyRec->findAndGetString(DCM_AccessionNumber, buff).good()) study->setAttribute("AccessionNumber", buff);
	if(studyRec->findAndGetString(DCM_StudyDescription, buff).good()) study->setAttribute("StudyDescription", buff);
	if(studyRec->findAndGetString(DCM_ReferringPhysiciansName, buff).good()) study->setAttribute("ReferringPhysicianName", buff);
	patient->appendChild(study);

	DcmDirectoryRecord *seriesRec = NULL;
	while(seriesRec = studyRec->nextSub(seriesRec))
	{
		if(seriesRec->getRecordType() != ERT_Series) continue;
		CreateSeriesNode(seriesRec, study, pXMLDom, studyUID);
	}
	return S_OK;
}
Exemplo n.º 6
0
/******************************************************************************
Function Name  :  SetData
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CVerifyResponse
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CVerifyResponse::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
    CString omstrTemp;
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
    INT lCount = (INT)m_ouData.m_odVerify_MessageEntityList.GetCount();
    MSXML2::IXMLDOMElementPtr pIDomSendNode =  pIDOMDoc->createElement(_bstr_t(def_STR_VERIFYRES_NODE));
    MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_ATTRIB_FAIL);

    if(pIDomTSAtrrib!= NULL)
    {
        switch(m_ouData.m_eAttributeError)
        {
            case SUCCESS:
                omstrTemp = "SUCCESS";
                break;

            case WARNING:
                omstrTemp = "WARNING";
                break;

            case FATAL:
                omstrTemp = "FATAL";
                break;

            case ERRORS:
            default:
                omstrTemp = "ERRORS";
                break;
        }

        pIDomTSAtrrib->value = _bstr_t(omstrTemp);
        pIDomSendNode->setAttributeNode(pIDomTSAtrrib);
    }

    MSXML2::IXMLDOMAttributePtr pIDomTSAtrribWait = pIDOMDoc->createAttribute(def_STR_ATTRIB_WAITFOR);

    if(pIDomTSAtrribWait!= NULL)
    {
        CString omstrWaitFor;
        omstrWaitFor.Format("%d", m_ushDuration);
        pIDomTSAtrribWait->value = _bstr_t(omstrWaitFor);
        pIDomSendNode->setAttributeNode(pIDomTSAtrribWait);
    }

    for(INT i=0; i<lCount; i++)
    {
        POSITION pos = m_ouData.m_odVerify_MessageEntityList.FindIndex(i);
        CVerify_MessageEntity& ouVerifyMsgEntity = m_ouData.m_odVerify_MessageEntityList.GetAt(pos);
        ouVerifyMsgEntity.SetData(pIDomSendNode);
    }

    pIDomTestCaseNode->appendChild(pIDomSendNode);
    return S_OK;
}
Exemplo n.º 7
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;
}
Exemplo n.º 8
0
/******************************************************************************
Function Name  :  SetData
Input(s)       :  MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode
Output         :  HRESULT
Functionality  :   
Member of      :  CReplayEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CReplayEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
    CString omstrTemp;
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
    if (pIDOMDoc != NULL)
    {
        MSXML2::IXMLDOMElementPtr pIDomWaitNode =  pIDOMDoc->createElement(_bstr_t(def_STR_REPLAY_NODE));
        pIDomWaitNode->Puttext(_bstr_t(m_omFilePath));
        pIDomTestCaseNode->appendChild(pIDomWaitNode);
    }
    return S_OK;
}
Exemplo n.º 9
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;
}
Exemplo n.º 10
0
/******************************************************************************
Function Name  :  SetData
Input(s)       :  MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode
Output         :  HRESULT
Functionality  :   
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CTestCaseEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
    CString omstrTemp;
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
    
    MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_ID);
    if(pIDomTSAtrrib!= NULL)
	{
        pIDomTSAtrrib->value = _bstr_t(m_ouData.m_omID);
		pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
	}

    pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_TITLE);
    if(pIDomTSAtrrib!= NULL)
	{
        pIDomTSAtrrib->value = _bstr_t(m_ouData.m_omTitle);
		pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
	}

    pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_H_EXP);
    if(pIDomTSAtrrib!= NULL)
	{
        switch(m_ouData.m_eExcpAction)
        {
            case EXIT:
                omstrTemp = "EXIT";
                break;
            case CONTINUE:
            default:
                omstrTemp = "CONTINUE";
                break;
        }
        pIDomTSAtrrib->value = _bstr_t(omstrTemp);
		pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
	}

    INT lCount = (INT)m_ouData.m_odTAEntityList.GetCount();
    for(int i=0; i<lCount;i++)
    {
        POSITION pos = m_ouData.m_odTAEntityList.FindIndex(i);
        CBaseEntityTA* pEntity = m_ouData.m_odTAEntityList.GetAt(pos);
        pEntity->SetData(pIDomTestCaseNode);
    }
    
    
    return 0;
}
Exemplo n.º 11
0
// 往xml文件里添加换行、制表符
void WXmlParse::appendTextNode(MSXML2::IXMLDOMDocumentPtr &pDoc, MSXML2::IXMLDOMElementPtr &element, UINT childLevel)
{
	CString text(_T("\r\n"));
	for (UINT i = 0;i < childLevel;i++)
		text += "\t";
	element->appendChild(pDoc->createTextNode((_bstr_t)text));   
}
Exemplo n.º 12
0
/******************************************************************************
Function Name  :  SetData
Input(s)       :  MSXML2::IXMLDOMElementPtr& pIDomVerifyNode
Output         :  HRESULT
Functionality  :  Creates the XML file with pIDomVerifyNode
Member of      :  CVerify_MessageEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam, GT-Derka
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CVerify_MessageEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomVerifyNode)
{
    CString omstrTemp;
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");

    MSXML2::IXMLDOMElementPtr pChildElement, pSubElement;

    if (pIDOMDoc != nullptr)
    {
        pChildElement   =  pIDOMDoc->createElement(_bstr_t(_(def_STR_VERIFYMSG_NODE)));

        MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_ID);
        if(pIDomTSAtrrib!= nullptr)
        {
            pIDomTSAtrrib->value = _bstr_t(m_ouData.m_dwMessageID);
            pChildElement->setAttributeNode(pIDomTSAtrrib);
        }

        pIDomTSAtrrib = pIDOMDoc->createAttribute(_(def_STR_TCATTRIB_UNIT));
        if(pIDomTSAtrrib!= nullptr)
        {
            switch(m_ouData.m_eSignalUnitType)
            {
                case ENG:
                    omstrTemp = "ENG";
                    break;
                default:
                case RAW:
                    omstrTemp = "RAW";
                    break;
            }
            pIDomTSAtrrib->value = _bstr_t(omstrTemp);
            pChildElement->setAttributeNode(pIDomTSAtrrib);
        }

        pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_CHANNEL);
        if(pIDomTSAtrrib!= NULL)
        {
            pIDomTSAtrrib->value = _bstr_t(m_ouData.m_byChannelNumber);
            pChildElement->setAttributeNode(pIDomTSAtrrib);
        }

        INT lCount = (INT)m_ouData.m_odSignalConditionList.GetCount();
        for(INT i =0; i<lCount; i++)
        {
            POSITION pos = m_ouData.m_odSignalConditionList.FindIndex(i);
            CSignalCondition& ouSignalData = m_ouData.m_odSignalConditionList.GetAt(pos);
            pSubElement   =  pIDOMDoc->createElement(_bstr_t(_(def_STR_SIGNAL_NODE)));
            pIDomTSAtrrib = pIDOMDoc->createAttribute(_(def_NAME_NODE));
            pIDomTSAtrrib->value = _bstr_t(ouSignalData.m_omSigName);
            pSubElement->setAttributeNode(pIDomTSAtrrib);
            pSubElement->Puttext(_bstr_t(ouSignalData.m_omCondition));
            pChildElement->appendChild(pSubElement);
        }
        pIDomVerifyNode->appendChild(pChildElement);
    }
    return S_OK;
}
Exemplo n.º 13
0
	//-------------------------------------------------------------------------
	// Function Name    :EncodeBase64
	// Parameter(s)     :LPBYTE *pBuf	The binary buffer
	//					:ULONG ulSize	size
	// Return           :CString		the result
	// Memo             :encoding the binary buffer into Base64 string
	//-------------------------------------------------------------------------
	CString CXml::Base64Encode(LPBYTE pBuf, ULONG ulSize)
	{
		ASSERT( m_pDoc != NULL );
		ASSERT( pBuf != NULL );
		
		CString strRet = _T("");
		try
		{
			MSXML2::IXMLDOMElementPtr pElement = NULL;
			pElement = m_pDoc->createElement( _bstr_t(_T("Base64")) );
			ASSERT( pElement != NULL );

			HRESULT hr = S_OK;
			hr = pElement->put_dataType( _bstr_t(_T("bin.base64")) );
			ASSERT( SUCCEEDED(hr) );

			SAFEARRAY * pAry = SafeArrayCreateVector( VT_UI1, 0L, ulSize);
			::memcpy( pAry->pvData, pBuf, ulSize);

			VARIANT var;
			VariantInit(&var);
			var.parray = pAry;
			var.vt = VT_ARRAY | VT_UI1;
			pElement->nodeTypedValue = var;

			BSTR bstr = NULL;
			hr = pElement->get_text( &bstr );
			ASSERT( SUCCEEDED(hr) );	
			strRet = (LPCTSTR)_bstr_t( bstr, true);

			if( bstr != NULL )
			{
				SysFreeString(bstr);
				bstr = NULL;
			}

			RELEASE_PTR(pElement);
		}
		catch ( _com_error e )
		{
			TRACE( _T("CXml::Base64Encode failed:%s\n"), e.ErrorMessage());
			ASSERT( FALSE );
		}

		return strRet;
	}
Exemplo n.º 14
0
//装入项目
void CUpdateBuilderDlg::OnBnClickedLoadItem()
{
	CFileDialog dlg(TRUE, _T("*.xml"), _T("update.xml"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("XML File(*.xml)|*.xml||"));
	if (dlg.DoModal() == IDOK)
	{
		HRESULT hr = S_OK;
		MSXML2::IXMLDOMDocumentPtr	pXmlDoc;
		MSXML2::IXMLDOMNodeListPtr pNodeList;
		MSXML2::IXMLDOMElementPtr pElement;

		try
		{
			hr = pXmlDoc.CreateInstance(__uuidof(MSXML2::DOMDocument30));
			if( FAILED( hr ) ) 
				_com_issue_error(hr);

			pXmlDoc->load(CComVariant(dlg.GetPathName()));
			
			pNodeList = pXmlDoc->selectNodes("/manifest/filelist/file");
			
			m_FileListCtrl.DeleteAllItems();
			LONG lItemCount = pNodeList->Getlength();
			int nItem; 

			for (LONG lIndex = 0; lIndex < lItemCount; lIndex++)
			{
				pElement = pNodeList->Getitem(lIndex);
				nItem = m_FileListCtrl.InsertItem(0, CString(pElement->getAttribute("filename")));
				m_FileListCtrl.SetItemText(nItem, 1, CString(pElement->getAttribute("filesize")));
				m_FileListCtrl.SetItemText(nItem, 2, CString(pElement->getAttribute("fileversion")));
				m_FileListCtrl.SetItemText(nItem, 3, CString(pElement->getAttribute("md5")));
				m_FileListCtrl.SetItemData(nItem, (ULONG)pElement->getAttribute("filesize"));
			}

			SetWindowText(dlg.GetPathName());
			GetDlgItem(IDC_UPDATE_ITEM)->EnableWindow(TRUE);
		}
		catch(_com_error& e)
		{
			CString strError;
			strError.Format(_T("Error code:%d\nError Message:%s\nError Description:%s"), 
				(int)e.WCode(), e.ErrorMessage(), (char*)e.Description());
			MessageBox(strError, _T("错误"),MB_OK|MB_ICONSTOP);
		}
	}
}
Exemplo n.º 15
0
////////////////////////////////////////////////////////////////////////////
// Function: Create an XML DOM Document from Scratch in memory
////////////////////////////////////////////////////////////////////////////
HRESULT CXMLDocument::Build()
{
	// Create a root node
	MSXML2::IXMLDOMNodePtr pRoot;
	m_pDoc->createNode(CComVariant(MSXML2::NODE_ELEMENT), CComBSTR("Root"), NULL, &pRoot);

	// add child nodes
	HRESULT hr = S_OK;
	for (int i = 0; i < 10; i++)
	{
		MSXML2::IXMLDOMNodePtr pNode;
		m_pDoc->createNode(CComVariant(MSXML2::NODE_ELEMENT), CComBSTR("Order"), NULL, &pNode);

		MSXML2::IXMLDOMElementPtr pElement = pNode;
		if (pElement != NULL)
			pElement->setAttribute(CComBSTR("id"), CComVariant(i));

		MSXML2::IXMLDOMNodePtr p0 = NULL;
		CComVariant after;
		hr = pRoot->insertBefore(pNode, after, &p0);
		hr = CheckHR(hr, "inserting node");

		// The XML Document should now own the node.
		for (int j = 0; j < 10; j++)
		{
			MSXML2::IXMLDOMNodePtr pNode2;
			m_pDoc->createNode(CComVariant(MSXML2::NODE_ELEMENT), CComBSTR("Item"), NULL, &pNode2);

			MSXML2::IXMLDOMElementPtr pElement2 = pNode2;
			if (pElement2 != NULL)
				pElement2->setAttribute(CComBSTR("id"), CComVariant((i*10) + j));
	
			MSXML2::IXMLDOMNodePtr p1 = NULL;
			CComVariant after;
			hr = p0->insertBefore(pNode2, after, &p1);
			hr = CheckHR(hr, "inserting node");
			// The XML Document should now own the node.
		}
	}

	// Now attach this new subtree to the document.
	m_pDoc->appendChild(pRoot, NULL);

	return hr;
}
Exemplo n.º 16
0
/******************************************************************************
Function Name  :  bAddChildToNode
Input(s)       :  MSXML2::IXMLDOMElementPtr& pNodeElement, 
                  CString omNodeName 
                  CString omNodeval
Output         :  BOOL
Functionality  :   
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
BOOL CTestSetupEntity::bAddChildToNode(MSXML2::IXMLDOMElementPtr& pNodeElement, 
                                          CString omNodeName, CString omNodeval)
{
    BOOL bReturn = FALSE;
    MSXML2::IXMLDOMElementPtr pChildElement;
    MSXML2::IXMLDOMDocumentPtr m_pXMLDom;
    m_pXMLDom.CreateInstance(L"Msxml2.DOMDocument");
    if (pNodeElement != NULL)
    {
        pChildElement   =  m_pXMLDom->createElement(_bstr_t(omNodeName));
        if (pChildElement != NULL)
        {
            pChildElement->Puttext((_bstr_t)omNodeval);
            pNodeElement->appendChild(pChildElement);
            bReturn = TRUE;
        }
    }
    return bReturn;
}
Exemplo n.º 17
0
//设置指定xpath的节点属性
BOOL CXmlBase::SetAttrValue(LPCTSTR lpszValue, LPCTSTR lpszAttrName, MSXML2::IXMLDOMNodePtr pNode)
{
	if (lpszValue == NULL 
		|| lpszAttrName == NULL 
		|| pNode == NULL) return FALSE;
	MSXML2::IXMLDOMElementPtr pElem = pNode;
	//lc,国际化乱码问题
// 	CComVariant varText(_bstr_t(lpszValue).GetBSTR());
// 	HRESULT hr = pElem->setAttribute(_bstr_t(lpszAttrName).GetBSTR(), varText);
	BSTR bstr = SysAllocString(_bstr_t(lpszValue).GetBSTR());   //modify memory leak
	CComVariant varText(bstr);
	BSTR bstrName =SysAllocString(_bstr_t(lpszAttrName).GetBSTR());
	HRESULT hr = pElem->setAttribute(bstrName, varText);
	SysFreeString(bstr);
	bstr = NULL;
	SysFreeString(bstrName);
	bstrName = NULL;
	if (FAILED(hr)) return FALSE;
	return TRUE;
}
Exemplo n.º 18
0
static HRESULT CreateWADO(MSXML2::IXMLDOMDocumentPtr &pXMLDom)
{
	HRESULT hr = pXMLDom.CreateInstance(__uuidof(MSXML2::DOMDocument30));
	if (FAILED(hr)) return hr;
	pXMLDom->preserveWhiteSpace = VARIANT_FALSE;
	pXMLDom->async = VARIANT_FALSE;

	MSXML2::IXMLDOMElementPtr wado;
	MSXML2::IXMLDOMProcessingInstructionPtr pi;
	pi = pXMLDom->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"GBK\"");
	if (pi != NULL)
	{
		pXMLDom->appendChild(pi);
		pi.Release();
	}

	pi = pXMLDom->createProcessingInstruction("xml-stylesheet", "type=\"text/xml\" href=\"../xslt/wadolist.xsl\"");
	if (pi != NULL)
	{
		pXMLDom->appendChild(pi);
		pi.Release();
	}

	wado = pXMLDom->createNode(MSXML2::NODE_ELEMENT, "wado_query", "http://www.weasis.org/xsd");
	wado->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	wado->setAttribute("requireOnlySOPInstanceUID", "false");
	pXMLDom->appendChild(wado);
	wado->setAttribute("wadoURL", "http://localhost/pacs/cgi-bin/");
	/*
	MSXML2::IXMLDOMElementPtr httpTag;
	httpTag = pXMLDom->selectSingleNode("/wado_query/httpTag");
	if( ! httpTag )
	{
		httpTag = pXMLDom->createNode(MSXML2::NODE_ELEMENT, "httpTag", "http://www.weasis.org/xsd");
		wado->appendChild(httpTag);
	}
	httpTag->setAttribute("key", "callingAE");
	httpTag->setAttribute("value", "DEVICE");
	*/
	return S_OK;
}
Exemplo n.º 19
0
/******************************************************************************
Function Name  :  SaveFileAs
Input(s)       :  CString omFilePath
Output         :  HRESULT
Functionality  :
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
Codetag        :  CS006
******************************************************************************/
HRESULT CTestSetupEntity::SaveFileAs(CString omFilePath)
{
    if(omFilePath.IsEmpty() == TRUE)
    {
        return S_FALSE;
    }

    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;

    HRESULT hr = pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");

    if ( FAILED(hr) )
    {
        return S_FALSE;
    }


    MSXML2::IXMLDOMProcessingInstructionPtr pIDomPi;
    pIDomPi = pIDOMDoc->createProcessingInstruction(def_DOM_INSTRUCTION);
    VARIANT_BOOL b = TRUE;
    pIDOMDoc->put_preserveWhiteSpace(b);

    if (pIDomPi != nullptr)
    {
        pIDOMDoc->appendChild(pIDomPi);
    }

    //testSETUP Node <testsetup>
    MSXML2::IXMLDOMElementPtr pIDomTSNode = pIDOMDoc->createElement(_bstr_t(def_STR_TSNODE_NAME));
    pIDOMDoc->appendChild(pIDomTSNode);

    //Title Attribute <testsetup title = "">
    MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TSATTRIB_TITLE);
    if(pIDomTSAtrrib!= nullptr)
    {
        pIDomTSAtrrib->value = _bstr_t(m_omstrTestSetupTitle);
        pIDomTSNode->setAttributeNode(pIDomTSAtrrib);
    }

    //Descriprion Node <testsetup title = ""><description>
    MSXML2::IXMLDOMElementPtr pIDomDescriptionNode = pIDOMDoc->createElement(_bstr_t(def_STR_DESC_NODE));
    pIDomDescriptionNode->Puttext(_bstr_t(m_omstrDescription));
    pIDomTSNode->appendChild(pIDomDescriptionNode);

    //Heade Node
    MSXML2::IXMLDOMElementPtr pIDomHeaderNode = pIDOMDoc->createElement(_bstr_t(def_STR_HEADER_NAME));
    nSaveHeader(pIDomHeaderNode, omFilePath);
    pIDomTSNode->appendChild(pIDomHeaderNode);

    //TestCase List
    MSXML2::IXMLDOMElementPtr pIDomTestCaseNode = pIDOMDoc->createElement(_bstr_t(def_STR_TCLIST_NODE));
    SetData(pIDomTestCaseNode);
    pIDomTSNode->appendChild(pIDomTestCaseNode);
    FormatDOMDocument(pIDOMDoc, omFilePath);
    return S_OK;
}
Exemplo n.º 20
0
// 设置属性值
int CBpXMLNode::SetAttribute(const wchar_t *szAttrName, const wchar_t *szAttrValue)
{
	if (m_pDOMNode == NULL || szAttrName == NULL || szAttrValue == NULL)
		return XML_ERROR;

	if (m_pDOMNode->GetnodeType() != MSXML2::NODE_ELEMENT)
		return XML_ERROR;
	
	try
	{
		_bstr_t bstrName(szAttrName);
		MSXML2::IXMLDOMElementPtr pElemt = (MSXML2::IXMLDOMElementPtr)m_pDOMNode;
		pElemt->setAttribute(_bstr_t(szAttrName),_variant_t(szAttrValue));

	}
	catch (...)
	{
		return XML_ERROR;
	}
	return XML_OK;
}
Exemplo n.º 21
0
BOOL CIconImgList::PickUpGroups( MSXML2::IXMLDOMElementPtr& piGroup, int& nIndex)
{
    MSXML2::IXMLDOMNodeListPtr piGroupList;
    piGroupList = piGroup->GetchildNodes();

    MSXML2::IXMLDOMElementPtr piNode;
    MSXML2::IXMLDOMElementPtr piChild;

    int nParent = nIndex;

    _bstr_t cBstr;
    _variant_t cVariant;
    long lCount = piGroupList->Getlength();
    for( long lIndex = 0; lIndex < lCount; lIndex++)
    {
        piNode = piGroupList->Getitem( lIndex);
        if( _bstr_t( _T( "GROUP")) == piNode->GetbaseName())
        {
            cBstr = piNode->getAttribute( _bstr_t( _T( "TITLE")));
            cVariant = piNode->getAttribute( _bstr_t( _T( "ENABLE")));
            cVariant.ChangeType( VT_BOOL);

            m_astGroupData[ nIndex] = ( GROUPDATA*)malloc( sizeof( GROUPDATA) + ( sizeof( TCHAR) * ( cBstr.length() + 1)));

            m_astGroupData[ nIndex]->nParent = nParent;
            if( 1 <= nIndex)
            {
                if( FALSE == m_astGroupData[ nParent]->blEnable)
                {
                    cVariant.boolVal = VARIANT_FALSE;
                }
            }
            m_astGroupData[ nIndex]->blEnable = ( VARIANT_FALSE == cVariant.boolVal) ? FALSE : TRUE;
            lstrcpy( m_astGroupData[ nIndex]->szName, cBstr);

            nIndex++;

            PickUpGroups( piNode, nIndex);
        }
        else if( _bstr_t( _T( "ITEM")) == piNode->GetbaseName())
        {
            cVariant = piNode->getAttribute( _bstr_t( _T( "REF")));
            cVariant.ChangeType( VT_I4);
            for( int nIndex = 0; nIndex < m_nEnableCount; nIndex++)
            {
                if( cVariant.intVal == ( m_astIconStatus[ nIndex].nID + 1))
                {
                    m_astIconStatus[ nIndex].nParent = nParent;
                }
            }
        }
    }

    return TRUE;
}
Exemplo n.º 22
0
void CALLBACK LibDir(PPBORCA_DIRENTRY pEntry, void * lpData)
{
	MSXML2::IXMLDOMElementPtr childs((MSXML2::IXMLDOMElement *) lpData);
	
	MSXML2::IXMLDOMElementPtr object = childs->ownerDocument->createElement("object");
	
	object->setAttribute(_bstr_t("name"), _bstr_t(pEntry->lpszEntryName));
	object->setAttribute(_bstr_t("comment"), _bstr_t(pEntry->szComments));

	char lsnumber[30] = {0};
	itoa(pEntry->otEntryType, lsnumber, 10);
	object->setAttribute(_bstr_t("type"), _bstr_t(lsnumber));
	
	object->setAttribute(_bstr_t("typename"), 
		_bstr_t(orca.convertObjectType(pEntry->otEntryType)));

	itoa(pEntry->lEntrySize, lsnumber, 10);
	object->setAttribute(_bstr_t("size"), _bstr_t(lsnumber));

	tm *ptime = localtime(&pEntry->lCreateTime);
	strftime(lsnumber, sizeof(lsnumber), "%d.%m.%y %H:%M:%S", ptime);
	object->setAttribute(_bstr_t("createtime"), _bstr_t(lsnumber));

	childs->appendChild(object);
	object = NULL;
}
Exemplo n.º 23
0
bool CPbl2XML::Convert(MSXML2::IXMLDOMElementPtr &library, _bstr_t &path)
{
	MSXML2::IXMLDOMElementPtr childnode = library->ownerDocument->
		createElement("childs");

	char buffer[256] = {0};

	int iResult = m_orca.LibraryDirectory((char *) path, 
		buffer, sizeof(buffer),	LibDir, (LPVOID) childnode.GetInterfacePtr());

	if(iResult != PBORCA_OK) {
		CString msg; msg.Format("FAILED: LibraryDirectory(...) : %s", (char *) path);
		log.write(msg);
		
		childnode = NULL;
		return false;
	}

	_bstr_t xpath("childs");
	MSXML2::IXMLDOMNodeListPtr childlist = library->selectNodes(xpath);

	if(childlist->length > 0) {
		library->replaceChild(childnode, childlist->item[0]);
	} else {
		library->appendChild(childnode);
	}

	// сохраняем значение комментария библиотеки
	library->setAttribute(_bstr_t("comment"), _bstr_t(buffer));

	return true;
}
Exemplo n.º 24
0
/******************************************************************************
Function Name  :  SetData
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CVerifyEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CVerifyEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
    CString omstrTemp;
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");


    int lCount = m_ouData->m_odVerifySubEntityList.size();
    MSXML2::IXMLDOMElementPtr pIDomSendNode =  pIDOMDoc->createElement(_bstr_t(def_STR_VERIFY_NODE));
    MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_ATTRIB_FAIL);
    if(pIDomTSAtrrib!= NULL)
    {
        switch(m_ouData->m_eAttributeError)
        {
            case SUCCESS:
                omstrTemp = "SUCCESS";
                break;
            case WARNING:
                omstrTemp = "WARNING";
                break;
            case FATAL:
                omstrTemp = "FATAL";
                break;
            case ERRORS:
            default:
                omstrTemp = "ERRORS";
                break;
        }
        pIDomTSAtrrib->value = _bstr_t(omstrTemp);
        pIDomSendNode->setAttributeNode(pIDomTSAtrrib);
    }

    for(INT i=0; i<lCount; i++)
    {
		CVerifySubEntity *pVerifySubEntity = m_ouData->m_odVerifySubEntityList[i];
        pVerifySubEntity->SetData(pIDomSendNode);
    }
    pIDomTestCaseNode->appendChild(pIDomSendNode);
    return S_OK;
}
Exemplo n.º 25
0
STDMETHODIMP CLXSLTemplate::putref_stylesheet(ILDOMNode *newVal)
{
	m_stylesheet = newVal;

#if 0
	MSXML2::IXMLDOMDocument2Ptr msdocument(L"Msxml2.FreeThreadedDOMDocument.4.0");
	m_msstylesheet = Build(msdocument, m_stylesheet);

	MSXML2::IXMLDOMElementPtr msoutput = msdocument->createNode(_variant_t((long)1), _bstr_t(L"output"), _bstr_t(L"http://www.w3.org/1999/XSL/Transform"));
	msoutput->setAttribute(_bstr_t(L"method"), _bstr_t(L"xml"));

	if (msdocument->documentElement->firstChild != NULL)
		msdocument->documentElement->insertBefore(msoutput, _variant_t((IDispatch*)msdocument->documentElement->firstChild));
	else
		msdocument->documentElement->appendChild(msoutput);

//	MessageBox(NULL, m_msstylesheet->xml, "", MB_OK);

	m_mstemplate->stylesheet = m_msstylesheet;
#endif
	return S_OK;
}
Exemplo n.º 26
0
/******************************************************************************
Function Name  :  SetData
Input(s)       :  MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode
Output         :  HRESULT
Functionality  :   
Member of      :  CWaitEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CWaitEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
    CString omstrTemp;
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
    if (pIDOMDoc != NULL)
    {
        MSXML2::IXMLDOMElementPtr pIDomWaitNode =  pIDOMDoc->createElement(_bstr_t(def_STR_WAIT_NODE));

        MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_STTRIB_PURPOSE);
        if(pIDomTSAtrrib!= NULL)
	    {
            pIDomTSAtrrib->value = _bstr_t(m_ouData.m_omPurpose);
		    pIDomWaitNode->setAttributeNode(pIDomTSAtrrib);
	    }
        omstrTemp.Format("%d", m_ouData.m_ushDuration);
        pIDomWaitNode->Puttext(_bstr_t(omstrTemp));

        pIDomTestCaseNode->appendChild(pIDomWaitNode);
    }
    return S_OK;
}
// loads items (values) from XML DOM Node - elements with type <item value="(new item)">
BOOL CStringTableImpl::loadItemsFromXML(MSXML2::IXMLDOMNodeListPtr & pNodeList)
{
	Clear();  // smazani puvodniho obsahu
	
	MSXML2::IXMLDOMElementPtr pChild = NULL;
	_variant_t  Atr_val;	// textova hodnota atributu

	while((pChild = pNodeList->nextNode()) != NULL)
	{
		if(pChild->baseName == (_bstr_t) "item")  // definice jedne polozky
		{
			Atr_val = pChild->getAttribute("value");
			if(Atr_val.vt != VT_NULL)
			{
				CString new_item = (LPCTSTR) (_bstr_t) Atr_val;
				Add(new_item);
			}
		}
	}

	return TRUE;
}
Exemplo n.º 28
0
//-------------------------------------------------------------------------
// Function Name    :Base64Decode
// Parameter(s)     :LPCTSTR pszIn	Base64编码
//					:LPBYTE pBuf	缓冲区首地址
//					:ULONG &ulSize	缓冲区大小
// Return           :BOOL
// Memo             :将Base64编码解码为二进制形式 
//					注意!此函数的缓冲区需要在函数调用完后删除
//-------------------------------------------------------------------------
BOOL CXml::Base64Decode(LPCTSTR pszIn, LPBYTE& pBuf, LONG& lSize)
{
	ASSERT(m_pDoc != NULL);
	
	try
	{
		MSXML2::IXMLDOMElementPtr pElement = NULL;
		pElement = m_pDoc->createElement(_bstr_t(_T("Base64")));
		ASSERT(pElement != NULL);

		HRESULT hr = S_OK;
		hr = pElement->put_dataType(_bstr_t(_T("bin.base64")));
		ASSERT(SUCCEEDED(hr));

		hr = pElement->put_text(CComBSTR(pszIn));
		ASSERT(SUCCEEDED(hr));

        hr = SafeArrayGetUBound(pElement->nodeTypedValue.parray, 1, &lSize);
		ASSERT(SUCCEEDED(hr));
		lSize ++;

		pBuf = new BYTE[lSize];
		memset(pBuf, 0, lSize);

		memcpy(pBuf, LPVOID(pElement->nodeTypedValue.parray->pvData), lSize);	

		RELEASE_PTR(pElement);
	}
	catch (_com_error e)
	{
		TRACE(_T("CXml::Base64Decode 发生异常:%s\n"), e.ErrorMessage());
		ASSERT(FALSE);
		return FALSE;
	}
	
	return TRUE;
}
Exemplo n.º 29
0
// 向CAD窗口发送命令
void  SendMessageToCad(CString& strCommand, CStringArray& strParamArray)
{
	MSXML2::IXMLDOMDocumentPtr lpDocument;
	long hr = lpDocument.CreateInstance(__uuidof(DOMDocument));

	if ( FAILED(hr) ) 
		_com_raise_error(hr);

	MSXML2::IXMLDOMProcessingInstructionPtr lpInstruction = lpDocument->createProcessingInstruction("xml","version='1.0' encoding='GB2312'");
	lpDocument->appendChild(lpInstruction);

	MSXML2::IXMLDOMElementPtr lpRoot = lpDocument->createElement(LPCTSTR("root"));

	lpDocument->appendChild(lpRoot);

	// 数据类型:命令或数据
	MSXML2::IXMLDOMElementPtr lpCommand = lpDocument->createElement("command");

	lpCommand->setAttribute("name", _variant_t(strCommand));

	lpRoot->appendChild(lpCommand);

	// 参数列表
	for (int i=0; i<strParamArray.GetSize(); i++)
	{
		CString strParam = strParamArray.GetAt(i);
		CString strName = strParam.Left(strParam.Find('='));
		CString strValue = strParam.Right(strParam.GetLength()-strParam.Find('=')-1);

		MSXML2::IXMLDOMElementPtr lpParam = lpDocument->createElement("param");
		lpParam->setAttribute("name", _variant_t(strName));
		lpParam->setAttribute("value", _variant_t(strValue));

		lpCommand->appendChild(lpParam);
	}

	CString strXML = (LPCTSTR)(lpDocument->xml);
	//	OutputDebugString(lpDocument->xml);

	COPYDATASTRUCT cds;
	cds.dwData = 0;
	cds.cbData = strXML.GetLength()+1;
	cds.lpData = (void*)strXML.GetBuffer(0);
	strXML.ReleaseBuffer();
	::SendMessage(acedGetAcadFrame()->m_hWnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cds);
}
Exemplo n.º 30
0
BOOL CXMLParser3::GetRoot(LPCTSTR &strName, LPCTSTR strPara)
{
	try
	{
		MSXML2::IXMLDOMElementPtr pRoot = m_pXMLDom->documentElement;

		CString ss;
		ss = ((LPCTSTR)pRoot->nodeName);
		strName = (LPCTSTR)pRoot->nodeName;
		_variant_t var = pRoot->getAttribute(_T("Interface"));
		strPara = (LPCTSTR)var.bstrVal;
		return TRUE;
	}
	catch (_com_error &e)
	{
		m_nError = e.Error();
		m_strError = e.ErrorMessage();
		return FALSE;
	}
	catch (...)
	{
		return FALSE;
	}
}