本文整理汇总了C++中msxml2::IXMLDOMDocumentPtr类的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMDocumentPtr类的具体用法?C++ IXMLDOMDocumentPtr怎么用?C++ IXMLDOMDocumentPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IXMLDOMDocumentPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NotifyHandler
/*
* Private method that loads XML into an MSXML DomDocument object and passes
* this object to the event handler.
*/
bool XMPPXMLParser::NotifyHandler(const UTF32String& stanzaName)
{
bool continueParsing;
FixXMLNS();
MSXML2::IXMLDOMDocumentPtr xmlDoc;
xmlDoc.CreateInstance(CLSID_DOMDocument);
BOOL bSuccess = xmlDoc->loadXML(
_bstr_t(UTF::utf32to16(m_ParsedData).c_str()));
if(bSuccess)
{
m_Handlers.OnStanza(
xmlDoc, _bstr_t(UTF::utf32to16(stanzaName).c_str()));
continueParsing = true;
}
else
{
m_Logger.LogLoadXMLError(xmlDoc, UTF::utf32to16(m_ParsedData));
continueParsing = false;
}
return continueParsing;
}
示例2: setBuffer
BOOL APBuf::setBuffer(BSTR str, MSXML2::IXMLDOMDocumentPtr & xml)
{
xml.CreateInstance(_T("Msxml2.DOMDocument"));
xml->async = VARIANT_FALSE; // default - true,
//vytvoreni XML DOM z nacteneho XML stringu
CDirectoriesManager & m = ((CReportAsistentApp *) AfxGetApp())->m_pGeneralManager->DirectoriesManager;
CString str_b = str;
CFile f;
f.Open(m.getXMLFilesDirectory() + "\\plug_out_example1.xml", CFile::modeWrite |CFile::modeCreate);
f.Write((LPCTSTR) str_b, str_b.GetLength());
f.Close();
HRESULT hRes=xml->loadXML(str);
if (xml->parseError->errorCode != S_OK)
{
if ((str == NULL) || (* str == 0)) return FALSE;
CReportAsistentApp::ReportError(IDS_SIMPLE_FILTER_FAILED_SOURCE_LOAD, (LPCTSTR) xml->parseError->reason);
xml.Release();
xml = NULL;
return FALSE;
}
return TRUE;
}
示例3: readObject
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;
}
示例4: CreatePatientNode
static HRESULT CreatePatientNode(DcmDirectoryRecord *patientRecord, MSXML2::IXMLDOMDocumentPtr &pXMLDom)
{
MSXML2::IXMLDOMElementPtr patient, wado;
wado = pXMLDom->selectSingleNode("/wado_query");
if(wado == NULL) return CO_E_NOT_SUPPORTED;
patient = pXMLDom->createNode(MSXML2::NODE_ELEMENT, "Patient", "http://www.weasis.org/xsd");
if(patient == NULL) return CO_E_NOT_SUPPORTED;
const char *patientName = NULL, *patientID = NULL, *patientBirthDate = NULL, *patientBirthTime = NULL, *patientSex = NULL;
if(patientRecord->findAndGetString(DCM_PatientsName, patientName).bad()) return CO_E_NOT_SUPPORTED;
else patient->setAttribute("PatientName", patientName);
if(patientRecord->findAndGetString(DCM_PatientID, patientID).bad()) return CO_E_NOT_SUPPORTED;
else patient->setAttribute("PatientID", patientID);
if(patientRecord->findAndGetString(DCM_PatientsBirthDate, patientBirthDate).good())
patient->setAttribute("PatientBirthDate", patientBirthDate);
if(patientRecord->findAndGetString(DCM_PatientsBirthTime, patientBirthTime).good())
patient->setAttribute("PatientBirthTime", patientBirthTime);
if(patientRecord->findAndGetString(DCM_PatientsSex, patientSex).good())
patient->setAttribute("PatientSex", patientSex);
wado->appendChild(patient);
DcmDirectoryRecord *studyRec = NULL;
while(studyRec = patientRecord->nextSub(studyRec))
{
if(studyRec->getRecordType() != ERT_Study) continue;
CreateStudyNode(studyRec, patient, pXMLDom);
}
return S_OK;
}
示例5: readExtendModName
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;
}
示例6: WriteNodeAttribute
bool XmlIOStreamImp::WriteNodeAttribute(const CString& attrName, const CString& attrValue)
{
DATA_ASSERT(!mbIsRead);
if(mbIsRead)
return false; // Can't write to the read stream.
DATA_ASSERT(mpCurrentNode != NULL);
if(NULL == mpCurrentNode)
return false;
MSXML2::IXMLDOMDocumentPtr xmlDocument = mpCurrentNode->GetownerDocument();
if (xmlDocument)
{
// Create attribute node
MSXML2::IXMLDOMAttributePtr attr = xmlDocument->createAttribute((LPCTSTR)attrName);
VARIANT va;
va.vt=VT_BSTR;
va.bstrVal = attrValue.AllocSysString();
attr->put_value(va);
mpCurrentNode->attributes->setNamedItem(attr);
VariantClear(&va);
return true;
}
return false;
}
示例7: GetDocument
MSXML2::IXMLDOMDocumentPtr CyDoc::GetDocument()
{
MSXML2::IXMLDOMDocumentPtr spDoc;
spDoc.CreateInstance(__uuidof(MSXML2::DOMDocument));
spDoc->async = VARIANT_FALSE;
spDoc->preserveWhiteSpace = VARIANT_TRUE;
spDoc->resolveExternals = VARIANT_FALSE;
return spDoc;
}
示例8: Clone
MSXML2::IXMLDOMDocument* CXmlDocumentWrapper::Clone()
{
if (!IsValid())
return NULL;
MSXML2::IXMLDOMDocumentPtr xmldoc;
xmldoc.CreateInstance(MSXML2::CLSID_DOMDocument);
_variant_t v(xmldoc.GetInterfacePtr());
m_xmldoc->save(v);
return xmldoc.Detach();
}
示例9: SetData
/******************************************************************************
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;
}
示例10: LoadExtIconData
BOOL CIconImgList::LoadExtIconData( void)
{
// 通常アイコンの読み込み
m_hBmpDefault = ::LoadBitmap( AfxGetResourceHandle(), MAKEINTRESOURCE( IDB_ICONIMG));
TCHAR szFilePath[ MAX_PATH];
int nLength = GetModuleFileName( NULL, szFilePath, MAX_PATH);
for( int nIndex = nLength; nIndex >= 0; nIndex--)
{
if( TEXT( '\\') == szFilePath[ nIndex])
{
lstrcpy( &szFilePath[ nIndex + 1], TEXT( "GetIcon.xml"));
break;
}
}
BOOL blResult = FALSE;
MSXML2::IXMLDOMDocumentPtr piDocument;
if( SUCCEEDED( piDocument.CreateInstance( _T( "Microsoft.XMLDOM"))))
{
piDocument->PutvalidateOnParse( VARIANT_TRUE);
if( VARIANT_FALSE != piDocument->load( _variant_t( _bstr_t( szFilePath))))
{
if( LoadIcons( piDocument))
{
blResult = LoadGroups( piDocument);
}
}
else
{
MSXML2::IXMLDOMParseErrorPtr piError;
piError = piDocument->GetparseError();
long lCode = piError->GeterrorCode();
TRACE( _T( "0x%08X\n"), lCode); // 0x800C0005
if( NULL != piError && 0 != lCode && 0x800C0005/*INET_E_RESOURCE_NOT_FOUND*/ != lCode)
{
long lRaw = piError->Getline();
long lCol = piError->Getlinepos();
_bstr_t cBstr = piError->Getreason();
_bstr_t cBstrSrc = piError->GetsrcText();
CString cStr;
cStr.Format( _T( "拡張アイコンデータファイルを解析できませんでした。\n%s\n\nソース:%s\n位置:%d行 %d文字"), ( ( char*)cBstr), ( ( char*)cBstrSrc), lRaw, lCol);
MessageBox( NULL, cStr, NULL, MB_OK | MB_ICONEXCLAMATION);
}
}
}
return blResult;
}
示例11: loadStylesFromXML
// loads lists of Word styles from configuration XML file
BOOL CWordManager::loadStylesFromXML(LPCTSTR XMLFilePath)
{
BOOL result = FALSE; // return value
CString FName; // jmeno (cesta) ke konfig. souboru
FName = XMLFilePath;
MSXML2::IXMLDOMDocumentPtr pXMLDom; // koren XML stromu
MSXML2::IXMLDOMElementPtr pNode; // korenovy element
MSXML2::IXMLDOMNodeListPtr pChildren; // seznam podelementu korenoveho elementu
MSXML2::IXMLDOMNodeListPtr pChildrenItems; // seznam podelementu elementu - vstupuje do funkce pro nacitani StringTable
MSXML2::IXMLDOMElementPtr pChild; // podelement korenoveho elementu
int i = 0; // indexova promenna
_variant_t Atr_val; // textova hodnota atributu
HRESULT hr;
//Vytvori COM objekt (resp. instanci objektu)
hr = pXMLDom.CreateInstance(_T("Msxml2.DOMDocument"));
if (FAILED(hr))
return FALSE;
pXMLDom->async = VARIANT_FALSE;
//nacti DOM ze souboru
if ( pXMLDom->load((LPCTSTR) FName) == VARIANT_TRUE)
{
pNode = pXMLDom->GetdocumentElement();
if (pNode != NULL)
{
if (pNode->baseName == (_bstr_t) "word_styles") // spravny nazev korenoveho elementu
{
pChildren = pNode->childNodes; // ziskani seznamu potomku
pChild = NULL;
while((pChild = pChildren->nextNode()) != NULL) // zpracovavaji se potomci
{
pChildrenItems = pChild->childNodes;
if (pChild->baseName == (_bstr_t) "templates")
m_WordTemplates.loadItemsFromXML(pChildrenItems);
else if (pChild->baseName == (_bstr_t) "paragraph_styles")
m_WordParagraphStyles.loadItemsFromXML(pChildrenItems);
else if (pChild->baseName == (_bstr_t) "character_styles")
m_WordCharacterStyles.loadItemsFromXML(pChildrenItems);
}
result = TRUE;
}
}
}
pXMLDom.Release();
return result;
}
示例12: InsertBefore
MSXML2::IXMLDOMNode* CXmlNodeWrapper::InsertBefore(MSXML2::IXMLDOMNode *refNode, LPCTSTR nodeName)
{
MSXML2::IXMLDOMDocumentPtr xmlDocument = m_xmlnode->GetownerDocument();
if (xmlDocument)
{
MSXML2::IXMLDOMNodePtr newNode = xmlDocument->createNode(_variant_t((short)MSXML2::NODE_ELEMENT),nodeName,"");
newNode = m_xmlnode->insertBefore(newNode.Detach(),(IUnknown*)refNode);
return newNode.Detach();
}
return NULL;
}
示例13: readCalculateParams
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;
}
示例14: SetData
/******************************************************************************
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;
}
示例15: LoadXML
CyNode CyDoc::LoadXML(const std::wstring& lpContent)
{
MSXML2::IXMLDOMDocumentPtr spDoc;
try
{
spDoc = GetDocument();
if(spDoc!=NULL){
spDoc->loadXML(lpContent.c_str());
}
} catch(...) {
}
m_spDocument = spDoc;
return CyNode(spDoc);
}