本文整理汇总了C++中IXMLDOMNode::selectNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNode::selectNodes方法的具体用法?C++ IXMLDOMNode::selectNodes怎么用?C++ IXMLDOMNode::selectNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXMLDOMNode
的用法示例。
在下文中一共展示了IXMLDOMNode::selectNodes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse4CVMKADForChannels
BOOL Parse4CVMKADForChannels( //return false if file could not be parsed
const TCHAR* pszTrgTypeName, //4cwin, 4cosai, ...
const TCHAR* pszAutoDeclIni, //full path and file name of AutoDecl.ini
IO_COMP_TYP** ppIOCmps //return, maqy be NULL if no channel def found
)
{
TCHAR szBuffer[2*MAX_PATH];
IXMLDOMNode* pNode;
IXMLDOMNode* pNode2;
IXMLDOMNodeList*pNList;
IXMLDOMNodeList*pNList2;
*ppIOCmps = NULL;
strcpy(szBuffer, pszAutoDeclIni);
FC_StringCutFilePart(szBuffer);
_tcscat(szBuffer, _T("\\"));
_tcscat(szBuffer, pszTrgTypeName);
_tcscat(szBuffer, _T("_4cvm.kad"));
pNode = XMLLoadFile(szBuffer);
if(!pNode)
return FALSE;
pNode2 = NULL;
pNode->get_firstChild(&pNode2); //assume first child is <TRGTYP EXT="4cwin" USECHANNELNUM="0">
FC_RELEASE_PTR(pNode)
if(!pNode2)
return FALSE;
pNList = NULL;
pNode2->selectNodes(L"IOCOMPONENTS", &pNList);
FC_RELEASE_PTR(pNode2)
if(!pNList)
return FALSE;
long len = 0;
pNList->get_length(&len);
ATLASSERT(len<=1);
if(len>0)
{
pNList->get_item(0, &pNode);
// <CHANNEL>
pNList2 = NULL;
pNode->selectNodes(L"CHANNEL", &pNList2);
*ppIOCmps = ReadIOComponents(pNList2);
FC_RELEASE_PTR(pNList2);
FC_RELEASE_PTR(pNode);
}
FC_RELEASE_PTR(pNList);
return TRUE;
}
示例2: GetNodesList
/*
Function name : CXML::GetNodesList
Description : retrieves the list of nodes with the given name
Return type : bool
Argument : CString csPathToNode
Argument : bool bCurrentNodeAsBase
*/
bool CXML::GetNodesList(CString csPathToNode,bool bCurrentNodeAsBase)
{
CString csPath;
IXMLDOMNode *pBaseNode = NULL;
if(bCurrentNodeAsBase)
{
if(!m_pICurrentNode) return false;
pBaseNode = m_pICurrentNode;
pBaseNode->AddRef();
csPath.Format("./%s",csPathToNode);
}
else
{
if(!m_pIRootNode) return false;
pBaseNode = m_pIRootNode;
pBaseNode->AddRef();
csPath.Format("/%s",csPathToNode);
}
_bstr_t bstrPath(csPath);
if(m_pNodeList)
{
m_pNodeList->Release();
m_pNodeList = NULL;
}
m_hr = pBaseNode->selectNodes(bstrPath,&m_pNodeList);
pBaseNode->Release();
if(!SUCCEEDED(m_hr) || !m_pNodeList)
return false;
return true;
}
示例3: LoadProperty
bool CModelToolCharDataTable::LoadProperty(const char * lpszFullPathFileName)
{
CNtlXMLDoc doc;
if(doc.Create() == false)
{
_ASSERT(0);
return false;
}
if(doc.Load( const_cast<char *>(lpszFullPathFileName) ) == false)
{
_ASSERT(0);
return false;
}
char szBuffer[1024];
if( !doc.GetDataWithXPath(const_cast<char *>(XML_PROP_NAME_ATTRIBUTE), szBuffer, sizeof(szBuffer)) )
{
_ASSERT(0);
return false;
}
sMODELTOOL_CHAR_TBLDAT *pModelToolCharData = new sMODELTOOL_CHAR_TBLDAT;
Add(szBuffer, pModelToolCharData);
IXMLDOMNodeList *pAnimDataList = doc.SelectNodeList(XML_PROP_ANIM_DATA_ELEMENT);
IXMLDOMNode* pAnimDataNode = NULL;
IXMLDOMNodeList *pAnimEventList = NULL;
IXMLDOMNode* pAnimEventNode = NULL;
long lAnimDataNodeNum = 0;
long lAnimEventNodeNum = 0;
int nAnimKeyID = 0;
float fDurationTime = 0.f;
BYTE byPushCount = 0;
BYTE byKnockDownCount = 0;
bool bKB2Push = false;
BYTE byHitCount = 0;
float aHitTime[NTL_MAX_SIZE_HIT];
pAnimDataList->get_length(&lAnimDataNodeNum);
for(long m = 0; m < lAnimDataNodeNum ; ++m)
{
pAnimDataList->get_item(m,&pAnimDataNode);
if(!doc.GetTextWithAttributeName(pAnimDataNode, XML_PROP_ANIM_DATA_ELEMENT_KEYID_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
{
_ASSERT(0);
return false;
}
nAnimKeyID = atoi(szBuffer);
if(!doc.GetTextWithAttributeName(pAnimDataNode, XML_PROP_ANIM_DATA_ELEMENT_PLAYTIME_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
{
_ASSERT(0);
return false;
}
fDurationTime = (float)atof(szBuffer);
pAnimDataNode->selectNodes(L"ANIM_EVENT", &pAnimEventList);
pAnimEventList->get_length(&lAnimEventNodeNum);
memset(aHitTime, 0, sizeof(aHitTime));
for(long n = 0; n < lAnimEventNodeNum; ++n)
{
pAnimEventList->get_item(n, &pAnimEventNode);
if(!doc.GetTextWithAttributeName(pAnimEventNode, XML_PROP_ANIM_DATA_ELEMENT_EVENTID_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
{
_ASSERT(0);
return false;
}
int nAnimEventID = EVENT_ANIM_NONE;
int nBehavior = TARGET_BEHAVIOR_NONE;
nAnimEventID = atoi(szBuffer);
if(nAnimEventID == EVENT_ANIM_HIT)
{
if(!doc.GetTextWithAttributeName(pAnimEventNode, XML_PROP_ANIM_DATA_ELEMENT_HITBEHAVIOR_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
{
_ASSERT(0);
return false;
}
nBehavior = atoi(szBuffer);
if(nBehavior == TARGET_BEHAVIOR_PUSH)
{
byPushCount++;
}
else if(nBehavior == TARGET_BEHAVIOR_KNOCK_DOWN)
{
//.........这里部分代码省略.........
示例4: Load
// эта функция, если значения нет (или тип некорректный) *value НЕ трогает
bool SettingsXML::Load(const wchar_t *regName, wchar_t **value)
{
bool lbRc = false;
HRESULT hr = S_OK;
IXMLDOMNode* pChild = NULL;
IXMLDOMNamedNodeMap* pAttrs = NULL;
IXMLDOMAttribute *pIXMLDOMAttribute = NULL;
IXMLDOMNode *pNode = NULL;
IXMLDOMNodeList* pList = NULL;
BSTR bsType = NULL;
BSTR bsData = NULL;
size_t nLen = 0;
//if (*value) {free(*value); *value = NULL;}
if (mp_Key)
pChild = FindItem(mp_Key, L"value", regName, false);
if (!pChild)
return false;
hr = pChild->get_attributes(&pAttrs);
if (SUCCEEDED(hr) && pAttrs)
{
bsType = GetAttr(pChild, pAttrs, L"type");
}
if (SUCCEEDED(hr) && bsType)
{
if (!lstrcmpi(bsType, L"multi"))
{
// Тут значения хранятся так:
//<value name="CmdLineHistory" type="multi">
// <line data="C:\Far\Far.exe"/>
// <line data="cmd"/>
//</value>
wchar_t *pszData = NULL, *pszCur = NULL;
size_t nMaxLen = 0, nCurLen = 0;
long nCount = 0;
if (pAttrs) { pAttrs->Release(); pAttrs = NULL; }
// Получить все дочерние элементы нужного типа
bsData = ::SysAllocString(L"line");
hr = pChild->selectNodes(bsData, &pList);
::SysFreeString(bsData); bsData = NULL;
if (SUCCEEDED(hr) && pList)
{
hr = pList->get_length(&nCount);
if (SUCCEEDED(hr) && (nCount > 0))
{
HEAPVAL;
nMaxLen = ((MAX_PATH+1) * nCount) + 1;
pszData = (wchar_t*)malloc(nMaxLen * sizeof(wchar_t));
pszCur = pszData;
pszCur[0] = 0; pszCur[1] = 0;
nCurLen = 2; // сразу посчитать DoubleZero
HEAPVAL;
}
}
if (SUCCEEDED(hr) && pList)
{
hr = pList->reset();
while ((hr = pList->nextNode(&pNode)) == S_OK && pNode)
{
bsData = GetAttr(pNode, L"data");
pNode->Release(); pNode = NULL;
if (SUCCEEDED(hr) && bsData)
{
nLen = _tcslen(bsData) + 1;
if ((nCurLen + nLen) > nMaxLen)
{
// Нужно пересоздать!
nMaxLen = nCurLen + nLen + MAX_PATH + 1;
wchar_t *psz = (wchar_t*)malloc(nMaxLen * sizeof(wchar_t));
_ASSERTE(psz);
if (!psz) break; // Не удалось выделить память!
wmemmove(psz, pszData, nCurLen);
pszCur = psz + (pszCur - pszData);
HEAPVAL;
free(pszData);
pszData = psz;
HEAPVAL;
}
lstrcpy(pszCur, bsData);
pszCur += nLen; // указатель - на место для следующей строки
nCurLen += nLen;
*pszCur = 0; // ASCIIZZ
HEAPVAL;
//.........这里部分代码省略.........
示例5: GetVersionDependentKADFileName
/**
* GetVersionDependentKADFileName. Gets the version dependent compiler KAD.
* It uses the command line, if there is a target file it's firmware version
* is read and then using the <target type>_Addon.kad the final name of the kad is
* searched. If no target or no speciffic kad is specified in <target type>_Addon.kad
* the default kad <<target type>_4cvm.kad is assumed.
* @param pdm IN diag message sink
* @param pOpt IN the command line arguments
* @param kadFile OUT receives the kad file name and full path
* @param ulTrgVer OUT receive firmware version
* @return void
*/
static void GetVersionDependentKADFileName(
CGT_CDiagMsg* pdm,
const CMDL_OPT_TYP* pOpt,
FC_CString& kadFile,
unsigned long& ulTrgVer
)
{
FC_CString addonKad(MAX_PATH);
FC_CString prjPath(MAX_PATH);
FC_CString binPath(MAX_PATH);
IXMLDOMNode* pNode;
IXMLDOMNodeList*pNList;
long len;
FC_CString jot;
long i;
ulTrgVer = 0;
kadFile.clear();
binPath.load(g_szModuleName).stripFilePart();
prjPath.load(pOpt->sz4CP).stripFilePart();
//if there is a target file or check file given in the command line get the target version
if(!pOpt->szCheckFile.isEmpty())
{
//TODO: Workaround: passing an optional target version number via the command line
//is not possible because we may have very old backends, we pass this info
//inside a file with fixed name, old backend simple don't read it.
//If we make a new major version all backends should add this to there cmd line
//and then we don't need this tmp file any more...
FC_CString sCheckInfo(MAX_PATH);
sCheckInfo.load(prjPath)<<_T("\\gen\\checkinf.tmp");
ulTrgVer = GetPrivateProfileInt(_T("target"), _T("version"), 0, sCheckInfo);
}
else if(pOpt->targets.getUsed()>0)
{
ulTrgVer = GetTargetVersion(pdm, prjPath, pOpt->targets.get(0));
//Note: if more than one target is specified CGlobCtx::loadTargets() will
//later treat this as an "error not supported multiple targets".
//This solution here is only possible if at max one target at a time is built!
}
if(ulTrgVer>0)
{
//Addon KAD = "<installdir>\bin\<trgtyp>_Addon.kad"
addonKad<<binPath<<'\\'<<pOpt->szCurTrgTyp<<_T("_Addon.kad");
if(FC_Exist(addonKad))
{
//open xml file:
pNode = CGT_XMLLoadFile(pdm, NULL, addonKad, NULL);
if(pNode)
{
// read targets
pNList = NULL; len = 0;
pNode->selectNodes(L"FIRMWARE", &pNList);
FC_RELEASE_PTR(pNode);
pNList->get_length(&len);
for(i=0;i<len;i++)
{
pNList->get_item(i, &pNode);
if(CGT_XMLGetStrAttrTrim(pdm, pNode, L"VERSION", &jot, false, false))
{
if(strtoul(jot, NULL, 10)==ulTrgVer)
{
CGT_XMLGetStrAttrTrim(pdm, pNode, L"COMPILERKAD", &kadFile, false, true);
FC_RELEASE_PTR(pNode);
break;
}
}
FC_RELEASE_PTR(pNode);
}
}
}//<targettyp>_addon.kad does not exist, this is for backward compatibillity (4cec!)
}//else: maybe check file or build lib, we have no version info!! use default KAD
if(kadFile.isEmpty())
{//Not found in AddonKAD with version:
//default compiler kad = "<installdir>\bin\<trgtyp>_4cvm.kad"
kadFile<<binPath<<'\\'<<pOpt->szCurTrgTyp<<_T("_4cvm.kad");
}
else
{//Found in AddonKAD with version:
//make an absolute path:
kadFile.prepend(binPath, "\\");
}
}
示例6: GetKADFilenames
HRESULT CKADmerge::GetKADFilenames(string * sFilenames[], LONG &lLength, string sLogFile)
{
HRESULT hRes = S_FALSE;
if(sLogFile != "")
{
// open log file
OpenLog(sLogFile, sDescription + " GetKADFileNames");
}
IXMLDOMNode * pXMLRoot = NULL;
hRes = GetRootElement(m_pXMLKad, &pXMLRoot);
if(hRes == S_OK)
{
// find elements
IXMLDOMNodeList * pElemList = NULL;
_bstr_t bPatternString("/KAD4CE/KERNEL/ADDON[@KADFILE]");
hRes = pXMLRoot->selectNodes(bPatternString, &pElemList);
if(SUCCEEDED(hRes))
{
LONG lElements = 0;
pElemList->get_length(&lElements);
(*sFilenames) = new string[lElements];
IXMLDOMNode * pCurrentElem = NULL;
hRes = pElemList->nextNode(&pCurrentElem);
int i = 0;
while(pCurrentElem != NULL)
{
// find 'KADFILE' attribute
IXMLDOMNodeList * pAttrList = NULL;
_bstr_t bPatternString("@KADFILE");
hRes = pCurrentElem->selectNodes(bPatternString, &pAttrList);
if(SUCCEEDED(hRes))
{
LONG lAtributes = 0;
pAttrList->get_length(&lAtributes);
IXMLDOMNode * pCurrentAttr = NULL;
hRes = pAttrList->nextNode(&pCurrentAttr);
if(lAtributes == 1)
{
(*sFilenames)[i++] = GetValue(pCurrentAttr);
}
if(pCurrentAttr)
pCurrentAttr->Release();
}
hRes = pElemList->nextNode(&pCurrentElem);
if(pAttrList)
pAttrList->Release();
}
lLength = i;
hRes = S_OK;
if(pCurrentElem)
pCurrentElem->Release();
}
if(pXMLRoot)
pXMLRoot->Release();
if(pElemList)
pElemList->Release();
}
if(hRes == S_OK)
{
Log("GetKADFilenames:");
for(int i = 0; i < (int)lLength; i++)
{
Log((*sFilenames)[i]);
}
}
// close log file
CloseLog();
return hRes;
}
示例7: load
bool CKADInfo::load(
CGT_CDiagMsg* pdm,
const TCHAR* pszKADFileAndPath,
const TCHAR* pszTargetType,
unsigned long ulTrgVer
)
{
long i, o;
long len;
long len2;
long len3;
IXMLDOMNodeList* pNList;
IXMLDOMNodeList* pNList2;
IXMLDOMNodeList* pNList3;
IXMLDOMNode* pNode;
IXMLDOMNode* pNode2;
int nCurrErrors;
FC_CString jot(MAX_PATH);
bool bTargetTypeFound = false;
nCurrErrors = pdm->getTotalErrors();
//clear possible old content:
clear();
m_szKADFile.load(pszKADFileAndPath);
CG_InitSTEdipos(&m_KADEdp, m_szKADFile, 1);
pNode = CGT_XMLLoadFile(pdm, NULL, m_szKADFile, L"KAD4VM");
if(!pNode)
return false;
// read targets
pNList = NULL;
len = 0;
pNode->selectNodes(L"TRGTYP", &pNList);
assert(pNList);
FC_RELEASE_PTR(pNode);
pNList->get_length(&len);
for(i=0;i<len;i++)
{
pNList->get_item(i, &pNode);
if ( ! isCurrentTrgType(pdm, pszTargetType, pNode))
continue;
bTargetTypeFound = true;
// <IEC_FEATURES> : read IEC features : dadta types , languages
pNList2 = NULL;
pNode->selectNodes(L"IEC_FEATURES", &pNList2);
assert(pNList2);
ReadIecFeatures(pdm,
m_szKADFile,
pNList2,
&m_AllowedIEClanguages,
&m_AllowedIECtypes,
&m_AllowedArrayIndexIECtypes,
&m_lMaxTasks,
&m_bLocalRetain,
&m_CheckAddressSpace
);
FC_RELEASE_PTR(pNList2);
// <TASKIMAGE> : read task image features : segments, size, optimize
pNList2 = NULL;
pNode->selectNodes(L"TASKIMAGE", &pNList2);
assert(pNList2);
ReadTaskImageFeature(pdm,
m_szKADFile,
pNList2,
&m_useTIforSegm,
&m_optimizeTIforSegm,
m_lMaxRegionsWR,
m_lMaxRegionsRD,
ulTrgVer);
FC_RELEASE_PTR(pNList2);
// <IOCOMPONENTS>
pNList2 = NULL;
pNode->selectNodes(L"IOCOMPONENTS", &pNList2);
assert(pNList2);
len2 = 0;
pNList2->get_length(&len2);
for(o=0;o<len2;o++)
{
//.........这里部分代码省略.........