示例#1
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;
}
示例#2
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;
}
示例#3
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;
}
示例#4
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));   
}
/******************************************************************************
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;
}
// 向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);
}
示例#7
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;
}
/******************************************************************************
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;
}
/******************************************************************************
Function Name  :  nSaveTestCases
Input(s)       :  MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode
Output         :  INT
Functionality  :   
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
INT CTestSetupEntity::nSaveTestCases(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
    
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
    
    INT lCount = (INT)m_odTestCaseEntityList.GetCount();
    for(int i=0; i<lCount;i++)
    {
        MSXML2::IXMLDOMElementPtr pChildElement = pIDOMDoc->createElement(_bstr_t(def_STR_TESTCASE_NODE));
        POSITION pos = m_odTestCaseEntityList.FindIndex(i);
        CTestCaseEntity &odTestCaseEntity = m_odTestCaseEntityList.GetAt(pos);
        odTestCaseEntity.SetData(pChildElement);
        pIDomTestCaseNode->appendChild(pChildElement);
    }
    return S_OK;
}
示例#10
0
/******************************************************************************
Function Name  :  SetData
Input(s)       :  MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode
Output         :  HRESULT
Functionality  :  Creates the Xml Document 
Member of      :  CSendEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CSendEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
    CString omstrTemp;
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
    
    INT nCount = (INT)m_ouData.m_odSend_MessageDataList.GetCount();
    MSXML2::IXMLDOMElementPtr pIDomSendNode =  pIDOMDoc->createElement(_bstr_t(def_STR_SEND_NODE));
    for(INT i=0; i<nCount; i++)
    {
        POSITION pos = m_ouData.m_odSend_MessageDataList.FindIndex(i);
        CSend_MessageEntity& ouSendMsgEntity = m_ouData.m_odSend_MessageDataList.GetAt(pos);
        ouSendMsgEntity.SetData(pIDomSendNode);
    }
    pIDomTestCaseNode->appendChild(pIDomSendNode);
    return S_OK;
}
/******************************************************************************
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;
}
示例#12
0
static HRESULT CreateInstanceNode(DcmDirectoryRecord *instanceRec, MSXML2::IXMLDOMElementPtr &series, MSXML2::IXMLDOMDocumentPtr &pXMLDom, const char *studyUID, const char *seriesUID)
{
	MSXML2::IXMLDOMElementPtr instance = pXMLDom->createNode(MSXML2::NODE_ELEMENT, "Instance", "http://www.weasis.org/xsd");
	if(instance == NULL) return CO_E_NOT_SUPPORTED;
	const char *buff = NULL, *instanceUID = NULL, *transferSyntax = NULL;
	if(instanceRec->findAndGetString(DCM_ReferencedSOPInstanceUIDInFile, instanceUID).bad()) return CO_E_NOT_SUPPORTED;
	else instance->setAttribute("SOPInstanceUID", instanceUID);
	if(instanceRec->findAndGetString(DCM_ReferencedTransferSyntaxUIDInFile, transferSyntax).bad()) return CO_E_NOT_SUPPORTED;
	else instance->setAttribute("TransferSyntaxUID", transferSyntax);

	char url[512];
	sprintf_s(url, "getindex.exe?requestType=WADO&studyUID=%s&seriesUID=%s&objectUID=%s&contentType=application%%2Fdicom&transferSyntax=%s", 
		studyUID, seriesUID, instanceUID, transferSyntax);
	instance->setAttribute("DirectDownloadFile", url);

	if(instanceRec->findAndGetString(DCM_InstanceNumber, buff).good()) instance->setAttribute("InstanceNumber", buff);
	series->appendChild(instance);
	return S_OK;
}
示例#13
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;
}
示例#14
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;
}
LRESULT CSCProgramBlacklistDlg::OnApplyMessage(WPARAM wParam, LPARAM lParam)
{
	MSXML2::IXMLDOMDocument *pXmlDoc = reinterpret_cast<MSXML2::IXMLDOMDocument *>(wParam);
	ASSERT(pXmlDoc);

	MSXML2::IXMLDOMElement *pRootElem = reinterpret_cast<MSXML2::IXMLDOMElement *>(lParam);
	ASSERT(pRootElem);

	MSXML2::IXMLDOMElementPtr ProccessList = pXmlDoc->createElement(_T("ProccessList"));
	pRootElem->appendChild(ProccessList);

	for (int i = 0; i < m_list.GetItemCount(); i++)
	{
		MSXML2::IXMLDOMElementPtr ProccessInfo = pXmlDoc->createElement(_T("ProccessInfo"));
		ProccessList->appendChild(ProccessInfo);
		ProccessInfo->setAttribute(_T("Name"), (LPCTSTR)m_list.GetItemText(i, 1));
		ProccessInfo->setAttribute(_T("AddTime"), (LPCTSTR)m_list.GetItemText(i, 0));
		ProccessInfo->setAttribute(_T("Description"), (LPCTSTR)m_list.GetItemText(i, 2));
	}

	return TRUE;
}
示例#16
0
static HRESULT CreateSeriesNode(DcmDirectoryRecord *seriesRec, MSXML2::IXMLDOMElementPtr &study, MSXML2::IXMLDOMDocumentPtr &pXMLDom, const char *studyUID)
{
	MSXML2::IXMLDOMElementPtr series = pXMLDom->createNode(MSXML2::NODE_ELEMENT, "Series", "http://www.weasis.org/xsd");
	if(series == NULL) return CO_E_NOT_SUPPORTED;

	const char *buff = NULL, *seriesUID = NULL;
	if(seriesRec->findAndGetString(DCM_SeriesInstanceUID, seriesUID).bad()) return CO_E_NOT_SUPPORTED;
	else series->setAttribute("SeriesInstanceUID", seriesUID);
	if(seriesRec->findAndGetString(DCM_Modality, buff).bad()) return CO_E_NOT_SUPPORTED;
	else series->setAttribute("Modality", buff);
	if(seriesRec->findAndGetString(DCM_SeriesDescription, buff).good()) series->setAttribute("SeriesDescription", buff);
	if(seriesRec->findAndGetString(DCM_SeriesNumber, buff).good()) series->setAttribute("SeriesNumber", buff);
	study->appendChild(series);

	DcmDirectoryRecord *instanceRec = NULL;
	while(instanceRec = seriesRec->nextSub(instanceRec))
	{
		if(instanceRec->getRecordType() != ERT_Image) continue;
		CreateInstanceNode(instanceRec, series, pXMLDom, studyUID, seriesUID);
	}

	return S_OK;
}
/******************************************************************************
Function Name  :  nSaveHeader
Input(s)       :  
Output         :  INT
Functionality  :   
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
Codetag        :  CS025
******************************************************************************/
INT CTestSetupEntity::nSaveHeader(MSXML2::IXMLDOMElementPtr& pIDomHeaderNode, CString& omStrFilePath)
{
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
    MSXML2::IXMLDOMElementPtr pChildElement;
    MSXML2::IXMLDOMElementPtr pInfoElement;
    CString omstrTemp;
    //Module Info
    pInfoElement   =  pIDOMDoc->createElement(_bstr_t(def_STR_INFO_NODE));
    if (pInfoElement != NULL)
    {
        bAddChildToNode(pInfoElement, def_STR_CATEGORY_NODE, m_ouTestSetupHeader.m_sModuleName.m_omCategory);
        bAddChildToNode(pInfoElement, def_STR_VALUE_NODE, m_ouTestSetupHeader.m_sModuleName.m_omValue);
    }
    pIDomHeaderNode->appendChild(pInfoElement);
 
    //Version
    pInfoElement   =  pIDOMDoc->createElement(_bstr_t(def_STR_INFO_NODE));
    if (pInfoElement != NULL)
    {
        bAddChildToNode(pInfoElement, def_STR_CATEGORY_NODE, m_ouTestSetupHeader.m_sVersion.m_omCategory);
        bAddChildToNode(pInfoElement, def_STR_VALUE_NODE, m_ouTestSetupHeader.m_sVersion.m_omValue);
    }
    pIDomHeaderNode->appendChild(pInfoElement);
   
    //Engineer Name
    pInfoElement   =  pIDOMDoc->createElement(_bstr_t(def_STR_INFO_NODE));
    if (pInfoElement != NULL)
    {
    bAddChildToNode(pInfoElement, def_STR_CATEGORY_NODE, m_ouTestSetupHeader.m_sEngineerInfo1.m_omCategory);
        bAddChildToNode(pInfoElement, def_STR_VALUE_NODE, m_ouTestSetupHeader.m_sEngineerInfo1.m_omValue);
    }
    pIDomHeaderNode->appendChild(pInfoElement);
    
    //Engineer Role
    pInfoElement   =  pIDOMDoc->createElement(_bstr_t(def_STR_INFO_NODE));
    if (pInfoElement != NULL)
    {
        bAddChildToNode(pInfoElement, def_STR_CATEGORY_NODE, m_ouTestSetupHeader.m_sEngineerInfo2.m_omCategory);
        bAddChildToNode(pInfoElement, def_STR_VALUE_NODE, m_ouTestSetupHeader.m_sEngineerInfo2.m_omValue);
    }
    pIDomHeaderNode->appendChild(pInfoElement);

    //Bus Type
    pInfoElement   =  pIDOMDoc->createElement(_bstr_t(def_STR_DBPATH_NODE));
    bAddChildToNode(pInfoElement, def_STR_DATABASE, m_ouTestSetupHeader.m_omDatabasePath);
    pIDomHeaderNode->appendChild(pInfoElement);


    //Database Path
    pInfoElement   =  pIDOMDoc->createElement(_bstr_t(def_STR_BUS_TYPE));
    if(m_ouTestSetupHeader.m_eBus == CAN)
    {
         omstrTemp = "CAN";
    }
    pInfoElement->Puttext(_bstr_t(omstrTemp));
    pIDomHeaderNode->appendChild(pInfoElement);
    
    //Report File
    
    pInfoElement   =  pIDOMDoc->createElement(_bstr_t(def_STR_REPORT_NODE));

    

    if (pInfoElement != NULL)
    {
        switch(m_ouTestSetupHeader.m_sReportFile.m_eType)
        {
            case HTM:
                omstrTemp = "HTM";
                break;
            case TXT:
            default:
                omstrTemp = "TXT";
                break;
        };

        if(m_ouTestSetupHeader.m_sReportFile.m_omPath == "")
        {
            CString omReportPath(omStrFilePath);
            int nIndex = omReportPath.Find(".xml");
            omReportPath.Delete(nIndex, 4);

            CFile omFile(omStrFilePath,  CFile::modeRead);
            CString omReportName = omFile.GetFileTitle() + _T(".") + omstrTemp;
            omReportPath += omReportName;
            m_ouTestSetupHeader.m_sReportFile.m_omPath = omReportPath;
        }
        //Report Path
        bAddChildToNode(pInfoElement, def_STR_PATH_NODE, m_ouTestSetupHeader.m_sReportFile.m_omPath);
        //Extension
        bAddChildToNode(pInfoElement, def_STR_FORMAT_NODE, omstrTemp);

        switch(m_ouTestSetupHeader.m_sReportFile.m_eType)
        {
            case ABS:
                omstrTemp = "ABS";
                break;
            case REL:
            default:
                omstrTemp = "REL";
                break;
        }
        //Time
        bAddChildToNode(pInfoElement, def_STR_TIMEMODE_NODE, omstrTemp);
    }
    pIDomHeaderNode->appendChild(pInfoElement);
    
    return 0;
}
示例#18
0
BOOL WXmlParse::writeParam(const std::vector<WParamDefine *> &params)
{
	/*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;
	}

	docRoot = doc->createElement("ModuleName");
	//docRoot->setAttribute(_T("name"), (_variant_t) _T("CategoryProduct"));

	MSXML2::IXMLDOMElementPtr inputElement = doc->createElement("InputParam");
	docRoot->appendChild(inputElement);
	for (int i = 0;i < params.size();i++)
	{

	}*/

	MSXML2::IXMLDOMDocumentPtr pDoc = NULL; 
	MSXML2::IXMLDOMElementPtr xmlRoot = NULL; 
	MSXML2::IXMLDOMElementPtr xmlInput = NULL; 
	MSXML2::IXMLDOMProcessingInstructionPtr pPI = NULL; 
	//创建DOMDocument对象 
	pDoc.CreateInstance(__uuidof(DOMDocument30)); 
	pPI = pDoc->createProcessingInstruction("xml","version='1.0' encoding='gb2312'"); 
	_variant_t vNullVal; 
	vNullVal.vt = VT_NULL; 
	pDoc->insertBefore(pPI, vNullVal);
	//创建元素并添加到文档中 
	xmlRoot = pDoc->createElement((_bstr_t)"ModuleName"); 
	//设置属性 
	
	pDoc->appendChild(xmlRoot);
	appendTextNode(pDoc,xmlRoot,1);

	xmlInput = pDoc->createElement((_bstr_t)"InputParams");
	xmlInput->setAttribute(_T("name"), (_variant_t) _T("CategoryProduct"));
	xmlRoot->appendChild(xmlInput);
	appendTextNode(pDoc, xmlInput, 2);

	for (int i = 0;i < params.size();i++)
	{
		MSXML2::IXMLDOMElementPtr pProperty = pDoc->createElement((_bstr_t)"Property");
		pProperty->setAttribute((_bstr_t)"name", (_bstr_t)(params[i]->m_name.c_str()));
		xmlInput->appendChild(pProperty);
		appendTextNode(pDoc, pProperty, 3);
		WExtraMap::iterator it = params[i]->m_extraParams.begin();
		while (it != params[i]->m_extraParams.end())
		{
			MSXML2::IXMLDOMElementPtr pText = pDoc->createElement((_bstr_t)it->first.c_str());
			pText->put_text((_bstr_t)it->second.c_str());
			pProperty->appendChild(pText);
			appendTextNode(pDoc, pProperty, 3);
			it++;
		}
	}

	//添加“author”元素 
// 	MSXML2::IXMLDOMElementPtr pNode; 
// 	pNode=pDoc->createElement((_bstr_t)"Bank"); 
// 	xmlRoot->appendChild(pNode);
// 
// 	appendTextNode(pDoc,pNode,2);
// 
// 	MSXML2::IXMLDOMElementPtr pNode2; 
// 	pNode2=pDoc->createElement((_bstr_t)"Head"); 
// 	pNode->appendChild(pNode2);
// 
// 	appendTextNode(pDoc,pNode2,3);
// 
// 	MSXML2::IXMLDOMElementPtr pNode3; 
// 	pNode3=pDoc->createElement((_bstr_t)"PBCCode"); 
// 	pNode3->Puttext("局势"); 
// 	pNode2->appendChild(pNode3);
// 
// 	appendTextNode(pDoc,pNode2,2);
// 
// 	pNode3=pDoc->createElement((_bstr_t)"Code"); 
// 	pNode3->Puttext("局势"); 
// 	pNode2->appendChild(pNode3);
// 
// 	///////////////////////////////////////////////////
// 	appendTextNode(pDoc,pNode2,2);
// 	//////////////////////////////////////////////////////
// 	appendTextNode(pDoc,pNode,2);
// 
// 	pNode2=pDoc->createElement((_bstr_t)"Table1"); 
// 	pNode->appendChild(pNode2);
// 
// 	appendTextNode(pDoc,pNode2,3);
// 
// 	pNode3=pDoc->createElement((_bstr_t)"PBCCode"); 
// 	pNode3->Puttext("局势"); 
// 	pNode2->appendChild(pNode3);
// 
// 	appendTextNode(pDoc,pNode2,2);
// 
// 	pNode3=pDoc->createElement((_bstr_t)"Code"); 
// 	pNode3->Puttext("局势"); 
// 	pNode2->appendChild(pNode3);
// 
// 	///////////////////////////////////////////////////
// 	appendTextNode(pDoc,pNode2,2);
// 	//////////////////////////////////////////////////////
// 
// 	appendTextNode(pDoc,pNode,1);
// 	appendTextNode(pDoc,xmlRoot,0);
// 
 	pDoc->save("D:\\he.xml");

	return TRUE;
}