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; }
MSXML2::IXMLDOMNodePtr CXmlBase::CreateXmlTitle(MSXML2::IXMLDOMDocument2Ptr pDoc) { MSXML2::IXMLDOMProcessingInstructionPtr pi = NULL; MSXML2::IXMLDOMNodePtr pNode = NULL; if (pDoc == NULL) return NULL; try { pi = pDoc->createProcessingInstruction(_T("xml") , _T("version=\"1.0\" encoding=\"UTF-8\"")); if (pi == NULL) return NULL; pNode = pi; if (NULL == (pNode = pDoc->appendChild(pNode))) { pi.Release(); pNode.Release(); return NULL; } pi.Release(); //pNode.Release(); } catch(_com_error &e) { CString str; str.Format(_T("创建xml头发生异常。\r\nComError:\r\n%s") , e.ErrorMessage()); ::MessageBox( NULL,str, g_sAppTitle, MB_OK|MB_ICONERROR); return NULL; } catch(...) { return NULL; } return pNode; }