本文整理汇总了C++中IXMLDOMNodeListPtr类的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodeListPtr类的具体用法?C++ IXMLDOMNodeListPtr怎么用?C++ IXMLDOMNodeListPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IXMLDOMNodeListPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tcsicmp
VARIANT XMLDoc::getVariant(const XMLNodePtr &node, const TCHAR *tagName, int instans) {
VARIANT result;
result.vt = NULL;
if(node!=NULL) {
int i=0;
for(XMLNodePtr p = node->firstChild; p != NULL; p = p->nextSibling) {
if(p->nodeType==NODE_ELEMENT &&
_tcsicmp(((XMLElementPtr)p)->tagName,tagName) == 0 &&
i++ == instans) {
IXMLDOMNodeListPtr childList = p->childNodes;
LONG length;
childList->get_length(&length);
for(int j = 0; j < length; j++) {
IXMLDOMNodePtr item;
childList->get_item(j, &item);
DOMNodeType itemType;
item->get_nodeType(&itemType);
if(itemType == NODE_TEXT) {
item->get_nodeValue(&result);
return result;
}
}
return result;
}
}
}
return result;
}
示例2: ReadVerificationNode
BOOL vmsMetalinkFile::ReadVerificationNode(IXMLDOMNode *pNode, vmsMetalinkFile_File *file)
{
IXMLDOMNodeListPtr spNodeList;
pNode->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
IXMLDOMNodePtr spItem;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"hash")
{
vmsMetalinkFile_File_Hash hash;
if (ReadHashNode (spItem, &hash))
file->vHashes.add (hash);
}
spItem = NULL;
}
return TRUE;
}
示例3: GetDeviceList
static void GetDeviceList(IXMLDOMElement* e, DEVICELIST& d)
{
HRESULT hr;
IXMLDOMNodeListPtr list;
long listlength;
hr = e->get_childNodes(&list);
if(hr!=S_OK) throw _com_error(hr);
hr = list->get_length(&listlength);
if(hr!=S_OK) throw _com_error(hr);
for(size_t n=0;n<listlength;n++)
{
IXMLDOMNodePtr itemnode;
IXMLDOMElementPtr itemlement;
hr = list->get_item(n,&itemnode);
if(hr!=S_OK) throw _com_error(hr);
itemlement = itemnode;
DEVICE device;
GetDevice(itemlement,device);
d.push_back(device);
}
}
示例4: ReadResourcesNode
BOOL vmsMetalinkFile::ReadResourcesNode(IXMLDOMNode *pNode, vmsMetalinkFile_File *file)
{
IXMLDOMNodeListPtr spNodeList;
pNode->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
IXMLDOMNodePtr spItem;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"url")
{
vmsMetalinkFile_File_Url url;
if (ReadUrlNode (spItem, &url))
file->vMirrors.add (url);
}
spItem = NULL;
}
return TRUE;
}
示例5: ReadFilesNode
BOOL vmsMetalinkFile::ReadFilesNode(IXMLDOMNode *pFiles)
{
IXMLDOMNodeListPtr spNodeList;
pFiles->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
IXMLDOMNodePtr spItem;
BOOL bHasOkFileNode = FALSE;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"file")
{
if (ReadFileNode (spItem))
bHasOkFileNode = TRUE;
}
spItem = NULL;
}
return bHasOkFileNode;
}
示例6: GetStrings
static void GetStrings(IXMLDOMElement* e, std::vector<std::wstring>& v)
{
HRESULT hr;
IXMLDOMNodeListPtr children;
long listlength;
hr = e->get_childNodes(&children);
if(hr!=S_OK) throw _com_error(hr);
hr = children->get_length(&listlength);
if(hr!=S_OK) throw _com_error(hr);
for(size_t n=0;n<listlength;n++)
{
IXMLDOMElementPtr item;
IXMLDOMNodePtr itemnode;
_variant_t var;
std::wstring str;
hr = children->get_item(n,&itemnode);
if(hr!=S_OK) throw _com_error(hr);
item = itemnode;
hr = item->getAttribute(_bstr_t(L"value"),&var);
if(hr!=S_OK) throw _com_error(hr);
str = (LPCWSTR)(_bstr_t)var;
v.push_back(str);
}
}
示例7: GetGUIDs
static void GetGUIDs(IXMLDOMElement* e, std::vector<GUID>& v)
{
HRESULT hr;
IXMLDOMNodeListPtr children;
long listlength;
hr = e->get_childNodes(&children);
if(hr!=S_OK) throw _com_error(hr);
hr = children->get_length(&listlength);
if(hr!=S_OK) throw _com_error(hr);
for(size_t n=0;n<listlength;n++)
{
IXMLDOMElementPtr item;
IXMLDOMNodePtr itemnode;
_variant_t var;
GUID guid;
hr = children->get_item(n,&itemnode);
if(hr!=S_OK) throw _com_error(hr);
item = itemnode;
hr = item->getAttribute(_bstr_t(L"name"),&var);
if(hr!=S_OK) throw _com_error(hr);
string_to_guid((LPCWSTR)(_bstr_t)var,&guid);
v.push_back(guid);
}
}
示例8: GetULongs
static void GetULongs(IXMLDOMElement* e,std::vector<unsigned long>& v)
{
HRESULT hr;
IXMLDOMNodeListPtr children;
long listlength;
hr = e->get_childNodes(&children);
if(hr!=S_OK) throw _com_error(hr);
hr = children->get_length(&listlength);
if(hr!=S_OK) throw _com_error(hr);
for(size_t n=0;n<listlength;n++)
{
IXMLDOMElementPtr item;
IXMLDOMNodePtr itemnode;
_variant_t var;
unsigned long val;
hr = children->get_item(n,&itemnode);
if(hr!=S_OK) throw _com_error(hr);
item = itemnode;
hr = item->getAttribute(_bstr_t(L"val"),&var);
if(hr!=S_OK) throw _com_error(hr);
val = (unsigned long)var;
v.push_back(val);
}
}
示例9: GetGUIDLists
static void GetGUIDLists(IXMLDOMElement* e,std::map<unsigned long,std::vector<GUID> >& v)
{
HRESULT hr;
IXMLDOMNodeListPtr children;
long listlength;
hr = e->get_childNodes(&children);
if(hr!=S_OK) throw _com_error(hr);
hr = children->get_length(&listlength);
if(hr!=S_OK) throw _com_error(hr);
for(size_t n=0;n<listlength;n++)
{
IXMLDOMElementPtr item;
IXMLDOMNodePtr itemnode;
_variant_t var;
hr = children->get_item(n,&itemnode);
if(hr!=S_OK) throw _com_error(hr);
item = itemnode;
hr = item->getAttribute(_bstr_t(L"id"),&var);
if(hr!=S_OK) throw _com_error(hr);
GetGUIDs(item,v[(unsigned long)var]);
}
}
示例10: Parse
BOOL vmsMetalinkFile::Parse(LPCSTR pszFile)
{
USES_CONVERSION;
IXMLDOMDocumentPtr spXML;
IXMLDOMNodePtr spNode;
spXML.CreateInstance (__uuidof (DOMDocument));
if (spXML == NULL)
return FALSE;
spXML->put_async (FALSE);
VARIANT_BOOL bRes;
spXML->load (COleVariant (pszFile), &bRes);
if (bRes == FALSE)
return FALSE;
spXML->selectSingleNode (L"metalink", &spNode);
if (spNode == NULL)
return FALSE;
IXMLDOMNodeListPtr spNodeList;
spNode->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
IXMLDOMNodePtr spItem;
BOOL bHasOkFilesNode = FALSE;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"description")
{
CComBSTR bstrText;
spItem->get_text (&bstrText);
m_strDescription = W2A (bstrText);
}
else if (bstrName == L"files")
{
if (ReadFilesNode (spItem))
bHasOkFilesNode = TRUE;
}
spItem = NULL;
}
return bHasOkFilesNode;
}
示例11: GetBDATemplateConnections
static void GetBDATemplateConnections(IXMLDOMElement* e,std::vector<BDA_TEMPLATE_CONNECTION>& v)
{
HRESULT hr;
IXMLDOMNodeListPtr children;
long listlength;
hr = e->get_childNodes(&children);
if(hr!=S_OK) throw _com_error(hr);
hr = children->get_length(&listlength);
if(hr!=S_OK) throw _com_error(hr);
for(size_t n=0;n<listlength;n++)
{
IXMLDOMElementPtr item;
IXMLDOMNodePtr itemnode;
_variant_t var;
BDA_TEMPLATE_CONNECTION con;
hr = children->get_item(n,&itemnode);
if(hr!=S_OK) throw _com_error(hr);
item = itemnode;
hr = item->getAttribute(_bstr_t(L"FromNodeType"),&var);
if(hr!=S_OK) throw _com_error(hr);
con.FromNodeType = (unsigned long)var;
var.Clear();
hr = item->getAttribute(_bstr_t(L"FromNodePinType"),&var);
if(hr!=S_OK) throw _com_error(hr);
con.FromNodePinType = (unsigned long)var;
var.Clear();
hr = item->getAttribute(_bstr_t(L"ToNodeType"),&var);
if(hr!=S_OK) throw _com_error(hr);
con.ToNodeType = (unsigned long)var;
var.Clear();
hr = item->getAttribute(_bstr_t(L"ToNodePinType"),&var);
if(hr!=S_OK) throw _com_error(hr);
con.ToNodePinType = (unsigned long)var;
var.Clear();
v.push_back(con);
}
}
示例12: InsetXMLNode
void CXMLTree::InsetXMLNode(MSXML2::IXMLDOMNodePtr iNode, HTREEITEM hParentItem)
{
IXMLDOMNodeListPtr iChildren = iNode->childNodes;
IXMLDOMNodePtr iChild = NULL;
while ((iChild = iChildren->nextNode()) != NULL)
{
CString s((BSTR) iChild->nodeName);
HTREEITEM i = InsertItem(s, hParentItem);
iChild.AddRef();
SetItemData(i, (DWORD) (IXMLDOMNode *) iChild);
//rekurze
InsetXMLNode(iChild, i);
}
}
示例13: GetBDANodeDescriptors
static void GetBDANodeDescriptors(IXMLDOMElement* e,std::vector<BDANODE_DESCRIPTOR>& v)
{
HRESULT hr;
IXMLDOMNodeListPtr children;
long listlength;
hr = e->get_childNodes(&children);
if(hr!=S_OK) throw _com_error(hr);
hr = children->get_length(&listlength);
if(hr!=S_OK) throw _com_error(hr);
for(size_t n=0;n<listlength;n++)
{
IXMLDOMElementPtr item;
IXMLDOMNodePtr itemnode;
_variant_t var;
BDANODE_DESCRIPTOR con;
hr = children->get_item(n,&itemnode);
if(hr!=S_OK) throw _com_error(hr);
item = itemnode;
hr = item->getAttribute(_bstr_t(L"ulBdaNodeType"),&var);
if(hr!=S_OK) throw _com_error(hr);
con.ulBdaNodeType = (unsigned long)var;
var.Clear();
hr = item->getAttribute(_bstr_t(L"guidFunction"),&var);
if(hr!=S_OK) throw _com_error(hr);
string_to_guid((LPCWSTR)(_bstr_t)var,&con.guidFunction);
var.Clear();
hr = item->getAttribute(_bstr_t(L"guidName"),&var);
if(hr!=S_OK) throw _com_error(hr);
string_to_guid((LPCWSTR)(_bstr_t)var,&con.guidName);
var.Clear();
}
}
示例14: ReadFileNode
BOOL vmsMetalinkFile::ReadFileNode(IXMLDOMNode *pFile)
{
USES_CONVERSION;
IXMLDOMNodeListPtr spNodeList;
pFile->get_childNodes (&spNodeList);
if (spNodeList == NULL)
return FALSE;
vmsMetalinkFile_File file;
IXMLDOMNamedNodeMapPtr spAttrs;
pFile->get_attributes (&spAttrs);
if (spAttrs != NULL)
{
IXMLDOMNodePtr spFileName;
spAttrs->getNamedItem (L"name", &spFileName);
if (spFileName != NULL)
{
COleVariant vt;
spFileName->get_nodeValue (&vt);
ASSERT (vt.vt == VT_BSTR);
if (vt.vt == VT_BSTR)
file.strName = W2A (vt.bstrVal);
}
}
IXMLDOMNodePtr spItem;
while (SUCCEEDED (spNodeList->nextNode (&spItem)) && spItem != NULL)
{
CComBSTR bstrName;
spItem->get_nodeName (&bstrName);
if (bstrName == L"verification")
{
ReadVerificationNode (spItem, &file);
}
else if (bstrName == L"resources")
{
ReadResourcesNode (spItem, &file);
}
else if (bstrName == L"os")
{
CComBSTR bstrText;
spItem->get_text (&bstrText);
file.strOS = W2A (bstrText);
}
spItem = NULL;
}
if (file.vMirrors.size () == 0)
return FALSE;
m_vFiles.add (file);
return TRUE;
}
示例15: UpdateNodeFromItem
void CPageEvents::OnOK()
{
// Save any changes made to the currently-selected node's attributes
UpdateNodeFromItem(m_lParamSelected);
// Inspect the <Event> nodes of the document
if (NULL != m_spXMLDoc)
{
// Get all of the <Event> nodes in the document
IXMLDOMNodeListPtr spNodeList;
VERIFY(SUCCEEDED(m_spXMLDoc->getElementsByTagName(m_bstrEvent,
&spNodeList)));
// Process each node
IXMLDOMNodePtr spNode;
do
{
// Get the next node of the child list
VERIFY(SUCCEEDED(spNodeList->nextNode(&spNode)));
if (NULL != spNode)
{
// Query for the IXMLDOMElement interface
IXMLDOMElementPtr spElement(spNode);
ASSERT(NULL != spElement);
// Get the event id attribute
CComVariant varEventID;
spElement->getAttribute(m_bstrID, &varEventID);
VERIFY(SUCCEEDED(varEventID.ChangeType(VT_I4)));
AGCEventID idEventBegin = (AGCEventID)(V_UI4(&varEventID));
AGCEventID idEventEnd = (AGCEventID)(idEventBegin + 1);
// Get the LogAsNTEvent attribute
IXMLDOMAttributePtr spAttrNT;
if (S_OK == spElement->getAttributeNode(m_bstrLogAsNTEvent, &spAttrNT))
{
CComVariant varLog2NT;
spAttrNT->get_value(&varLog2NT);
VERIFY(SUCCEEDED(varLog2NT.ChangeType(VT_BOOL)));
// Add this event id to the range, if it should be logged
if (V_BOOL(&varLog2NT))
m_spRangesNT->AddByValues(idEventBegin, idEventEnd);
}
// Get the LogAsDBEvent attribute
IXMLDOMAttributePtr spAttrDB;
if (S_OK == spElement->getAttributeNode(m_bstrLogAsDBEvent, &spAttrDB))
{
CComVariant varLog2DB;
spAttrDB->get_value(&varLog2DB);
VERIFY(SUCCEEDED(varLog2DB.ChangeType(VT_BOOL)));
// Add this event id to the range, if it should be logged
if (V_BOOL(&varLog2DB))
m_spRangesDB->AddByValues(idEventBegin, idEventEnd);
}
}
} while (NULL != spNode);
// Set the enabled ranges of the event logger object
VERIFY(SUCCEEDED(m_spEventLogger->put_EnabledNTEvents(m_spRangesNT)));
VERIFY(SUCCEEDED(m_spEventLogger->put_EnabledDBEvents(m_spRangesDB)));
}
// Perform default processing
CPropertyPage::OnOK();
}