本文整理汇总了C++中IXMLDOMNode类的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNode类的具体用法?C++ IXMLDOMNode怎么用?C++ IXMLDOMNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IXMLDOMNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
HRESULT COFSNcDlg2::SelectChildNode(IXMLDOMNode *pNodeParent, BSTR bsSelect, IXMLDOMNode **ppNodeChild, BSTR *pbsNodeText)
{
HRESULT hr;
IXMLDOMNodeList *pNodeList = NULL;
IXMLDOMNode *pNodeChild = NULL;
if(pNodeParent == NULL || (ppNodeChild == NULL && pbsNodeText == NULL))
return E_INVALIDARG;
if(ppNodeChild != NULL)
*ppNodeChild = NULL;
DOMNodeType nt;
hr = pNodeParent->get_nodeType(&nt);
hr = pNodeParent->selectNodes(bsSelect, &pNodeList);
if(pNodeList)
{
hr = pNodeList->get_item(0, &pNodeChild);
if(pNodeChild != NULL)
{
if(pbsNodeText != NULL)
{
BSTR bs;
hr = pNodeChild->get_text(&bs);
*pbsNodeText = bs;
}
if(ppNodeChild == NULL)
{
pNodeChild->Release();
pNodeChild = NULL;
}
else
*ppNodeChild = pNodeChild;
}
pNodeList->Release();
pNodeList = NULL;
}
return hr;
}
示例2: NodeInList
/*
Function name : CXML::NodeInList
Description : retrieves the n th node in list
Return type : bool
Argument : long nIndex
*/
bool CXML::NodeInList(long nIndex)
{
if(!m_pNodeList) return false;
IXMLDOMNode * pNode = NULL;
m_hr = m_pNodeList->get_item(nIndex,&pNode);
if(!SUCCEEDED(m_hr) || !pNode)
return false;
if(m_pICurrentNode)
{
m_pICurrentNode->Release();
m_pICurrentNode = 0;
}
m_pICurrentNode = pNode;
m_pICurrentNode->AddRef();
pNode->Release();
return true;
}
示例3: NextNodeInList
/*
Function name : CXML::NextNodeInList
Description :
Return type : bool
Tested : ok
*/
bool CXML::NextNodeInList()
{
if(!m_pNodeList) return false;
IXMLDOMNode * pNode = NULL;
m_hr = m_pNodeList->nextNode(&pNode);
if(!SUCCEEDED(m_hr) || !pNode)
return false;
if(m_pICurrentNode)
{
m_pICurrentNode->Release();
m_pICurrentNode = 0;
}
m_pICurrentNode = pNode;
m_pICurrentNode->AddRef();
pNode->Release();
return true;
}
示例4: GoToNode
/*
Function name : CXML::GoToNode
Description : This function moves the current node to the node according to the pathtonode
: searching for the node starts either from the current node
: or it may start from the Root Node depending on the value of
: bool bUseBase.
Return type : bool
Argument : CString csPathToNode
Argument : bool bCurrentNodeAsBase
Tested : Ok
*/
bool CXML::GoToNode(CString csPathToNode,bool bCurrentNodeAsBase)
{
CString csPath;
IXMLDOMNode * pNode = NULL;
if(GetNode(&pNode,csPathToNode,NULL,NULL,bCurrentNodeAsBase))
{
if(m_pICurrentNode)
{
m_pICurrentNode->Release();
m_pICurrentNode = NULL;
}
m_pICurrentNode = pNode;
m_pICurrentNode->AddRef();
pNode->Release();
return true;
}
return false;
}
示例5: bstrData
/*
Function name : CXML::CreateNodeText
Description : This helper function Creates a text node as a child node of the pNode.
Return type : bool
Argument : IXMLDOMNode **pNode
Argument : CString &rcsNodeText
Tested : Ok
*/
bool CXML::CreateNodeText(IXMLDOMNode **pNode,CString &rcsNodeText)
{
IXMLDOMText * pTextNode = NULL;
if(!(*pNode))
return false;
_bstr_t bstrData(rcsNodeText);
m_hr = m_pXMLDoc->createTextNode(bstrData,&pTextNode);
if(!SUCCEEDED(m_hr) || !pTextNode)
return false;
IXMLDOMNode * pINewNode = NULL;
m_hr = (*pNode)->appendChild(pTextNode,&pINewNode);
pTextNode->Release();
if(!SUCCEEDED(m_hr) || !pINewNode)
return false;
pINewNode->Release();
return true;
}
示例6: GetNodeText
/*
Function name : CXML::GetNodeText
Description : This function will give node text.
: searching for the node starts either from the current node
: or it may start from the Root Node depending on the value of
: bool bUseBase.
Return type : bool
Argument : CString csPathToNode
Argument : CString csAttribute
Argument : CString csAttValue
Argument : CString &csValue
Argument : bool bCurrentNodeAsBase
Tested : Ok
*/
bool CXML::GetNodeText(CString csPathToNode,CString csAttribute,CString csAttValue,CString &rcsValue,bool bCurrentNodeAsBase)
{
CString csPath;
IXMLDOMNode * pNode = NULL;
IXMLDOMNode *pINodeData = NULL;
if(!GetNode(&pINodeData,csPathToNode,csAttribute,csAttValue,bCurrentNodeAsBase))
return false;
BSTR bstrNodeText;
m_hr = pINodeData->get_text(&bstrNodeText);
pINodeData->Release();
if (!SUCCEEDED(m_hr) || !bstrNodeText)
return false;
rcsValue = bstrNodeText;
SysFreeString(bstrNodeText);
return true;
}
示例7: AppendText
void SettingsXML::AppendText(IXMLDOMNode* apFrom, BSTR asText)
{
if (!asText || !*asText)
return;
VARIANT vtType;
IXMLDOMNode* pChild = NULL;
IXMLDOMNode *pIXMLDOMNode = NULL;
vtType.vt = VT_I4; vtType.lVal = NODE_TEXT;
HRESULT hr = mp_File->createNode(vtType, L"", L"", &pChild);
if (SUCCEEDED(hr) && pChild)
{
hr = pChild->put_text(asText);
hr = apFrom->appendChild(pChild, &pIXMLDOMNode); //-V519
pChild->Release(); pChild = NULL;
if (SUCCEEDED(hr) && pIXMLDOMNode)
{
pIXMLDOMNode->Release(); pIXMLDOMNode = NULL;
}
}
}
示例8: 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;
}
示例9: xmlGetAttributeValueBOOL
BOOL TxSkin::elVBOX::loadXML( IXMLDOMNode* node, LPCWSTR baseurl )
{
BOOL ret = skin_element::loadXML(node, baseurl);
m_adapt = xmlGetAttributeValueBOOL(node, TEXT("adapt"), TRUE);
IXMLDOMNode* child = NULL;
node->get_firstChild(&child);
while(child)
{
BSTR name = NULL;
child->get_nodeName(&name);
if(name)
{
skin_element* el = m_skin->createElement(name, m_skin);
if(el)
{
if(el->loadXML(child, baseurl))
{
addElement(el);
} else
{
delete el;
}
}
SysFreeString(name);
}
IXMLDOMNode* newChild = NULL;
child->get_nextSibling(&newChild);
child->Release();
child = newChild;
}
return ret;
}
示例10: MoveToParentNode
/*
Function name : CXML::MoveToParentNode
Description : This function will move to the n th parent the current node.
Return type : bool
Argument : UINT nNthParent
Tested : Ok
*/
bool CXML::MoveToParentNode(UINT nNthParent)
{
if(!m_pICurrentNode)
return false;
IXMLDOMNode * pITempNode = m_pICurrentNode;
IXMLDOMNode * pNode = NULL;
pITempNode->AddRef();
for(UINT i=0;i<nNthParent;++i)
{
if(pNode)
{
pNode ->Release();
pNode = NULL;
}
m_hr = pITempNode ->get_parentNode(&pNode);
if (!SUCCEEDED(m_hr) || !pNode)
{
pITempNode->Release();
return false;
}
if(pITempNode)
{
pITempNode->Release();
pITempNode = NULL;
}
pITempNode = pNode;
pITempNode->AddRef();
}
if(pNode)
{
pITempNode->Release();
m_pICurrentNode->Release();
m_pICurrentNode = pNode;
m_pICurrentNode->AddRef();
pNode->Release();
pNode= NULL;
}
return true;
}
示例11: GoToNodeEx
/*
Function name : CXML::GoToNode
Description : Moves to the node having the specified text
Return type : bool
Argument : CString csPathToNode
Argument : CString csNodeText
Argument : bool bCurrentNodeAsBase
Tested : Not working
*/
bool CXML::GoToNodeEx(CString csPathToNode,CString csNodeText,bool bCurrentNodeAsBase)
{
CString csPath;
IXMLDOMNode *pBaseNode = NULL;
if(bCurrentNodeAsBase)
{
if(!m_pICurrentNode) return false;
pBaseNode = m_pICurrentNode;
pBaseNode->AddRef();
csPath.Format("./%s[.= \"%s\"]",csPathToNode,csNodeText);
}
else
{
if(!m_pIRootNode) return false;
pBaseNode = m_pIRootNode;
pBaseNode->AddRef();
csPath.Format("/%s[.= \"%s\"]",csPathToNode,csNodeText);
}
BSTR bstrPath = csPath.AllocSysString();
IXMLDOMNode * pNode = NULL;
m_hr = pBaseNode->selectSingleNode(bstrPath,&pNode);
pBaseNode->Release();
SysFreeString(bstrPath);
if(!SUCCEEDED(m_hr) || !pNode)
return false;
if(m_pICurrentNode)
{
m_pICurrentNode->Release();
m_pICurrentNode = NULL;
}
m_pICurrentNode = pNode;
m_pICurrentNode->AddRef();
pNode->Release();
return true;
}
示例12: vtNodeType
/*
Function name : CXML::CreateAttributeNode
Description :
Return type : bool
Argument : IXMLDOMNode **pParentNode
Argument : CString csAttribute
Argument : CString csValue
Tested : Ok
*/
bool CXML::CreateAttributeNode(IXMLDOMNode **pParentNode,CString csAttribute,CString csValue)
{
IXMLDOMNode * pNode = NULL;
if(csAttribute.IsEmpty())
return false;
if(!(*pParentNode))
return false;
_variant_t vtNodeType((long)NODE_ATTRIBUTE);
_bstr_t bstrName(csAttribute);
_bstr_t bstrNameSpace("");
m_hr = m_pXMLDoc->createNode(vtNodeType,bstrName,bstrNameSpace,&pNode);
if(!SUCCEEDED(m_hr))
return false;
IXMLDOMNamedNodeMap * pAttributes = NULL;
m_hr = (*pParentNode)->get_attributes(&pAttributes);
if(!SUCCEEDED(m_hr) || !pAttributes)
{
pNode->Release();
return false;
}
IXMLDOMNode *pNewNode = NULL;
m_hr = pAttributes->setNamedItem(pNode,&pNewNode);
pNode->Release();
pAttributes->Release();
if(!SUCCEEDED(m_hr) || !pNewNode)
return false;
_variant_t vtValue(csValue);
m_hr = pNewNode->put_nodeValue(vtValue);
pNewNode->Release();
if(!SUCCEEDED(m_hr) || !pNewNode)
return false;
return true;
}
示例13: FAILED
bool CDirect3D::SetShaderHLSL(const TCHAR *file)
{
//MUDLORD: the guts
//Compiles a shader from files on disc
//Sets LUT textures to texture files in PNG format.
TCHAR folder[MAX_PATH];
TCHAR rubyLUTfileName[MAX_PATH];
TCHAR *slash;
char *shaderText = NULL;
TCHAR errorMsg[MAX_PATH + 50];
IXMLDOMDocument * pXMLDoc = NULL;
IXMLDOMElement * pXDE = NULL;
IXMLDOMNode * pXDN = NULL;
BSTR queryString, nodeContent;
HRESULT hr;
shaderTimer = 1.0f;
shaderTimeStart = 0;
shaderTimeElapsed = 0;
if(effect) {
effect->Release();
effect = NULL;
}
for(int i = 0; i < MAX_SHADER_TEXTURES; i++) {
if (rubyLUT[i] != NULL) {
rubyLUT[i]->Release();
rubyLUT[i] = NULL;
}
}
if (file == NULL || *file==TEXT('\0'))
return true;
hr = CoCreateInstance(CLSID_DOMDocument,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&pXMLDoc));
if(FAILED(hr)) {
MessageBox(NULL, TEXT("Error creating XML Parser"), TEXT("Shader Loading Error"),
MB_OK|MB_ICONEXCLAMATION);
return false;
}
VARIANT fileName;
VARIANT_BOOL ret;
fileName.vt = VT_BSTR;
#ifdef UNICODE
fileName.bstrVal = SysAllocString(file);
#else
wchar_t tempfilename[MAX_PATH];
MultiByteToWideChar(CP_UTF8,0,file,-1,tempfilename,MAX_PATH);
fileName.bstrVal = SysAllocString(tempfilename);
#endif
hr = pXMLDoc->load(fileName,&ret);
SysFreeString(fileName.bstrVal);
if(FAILED(hr) || hr==S_FALSE) {
_stprintf(errorMsg,TEXT("Error loading HLSL shader file:\n%s"),file);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
pXMLDoc->Release();
return false;
}
VARIANT attributeValue;
BSTR attributeName;
hr = pXMLDoc->get_documentElement(&pXDE);
if(FAILED(hr) || hr==S_FALSE) {
_stprintf(errorMsg,TEXT("Error loading root element from file:\n%s"),file);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
pXMLDoc->Release();
return false;
}
attributeName=SysAllocString(L"language");
pXDE->getAttribute(attributeName,&attributeValue);
SysFreeString(attributeName);
pXDE->Release();
if(attributeValue.vt!=VT_BSTR || lstrcmpiW(attributeValue.bstrVal,L"hlsl")) {
_stprintf(errorMsg,TEXT("Shader language is <%s>, expected <HLSL> in file:\n%s"),attributeValue.bstrVal,file);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
if(attributeValue.vt==VT_BSTR) SysFreeString(attributeValue.bstrVal);
pXMLDoc->Release();
return false;
}
if(attributeValue.vt==VT_BSTR) SysFreeString(attributeValue.bstrVal);
queryString=SysAllocString(L"/shader/source");
hr = pXMLDoc->selectSingleNode(queryString,&pXDN);
SysFreeString(queryString);
if(hr == S_OK) {
hr = pXDN->get_text(&nodeContent);
if(hr == S_OK) {
int requiredChars = WideCharToMultiByte(CP_ACP,0,nodeContent,-1,shaderText,0,NULL,NULL);
shaderText = new char[requiredChars];
WideCharToMultiByte(CP_UTF8,0,nodeContent,-1,shaderText,requiredChars,NULL,NULL);
//.........这里部分代码省略.........
示例14: _ASSERT
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)
{
//.........这里部分代码省略.........
示例15: strPath
bool CModelToolCharDataTable::LoadPropertyList(const char *lpszPath, const char * lpszFileName)
{
CNtlXMLDoc doc;
std::string strPath( lpszPath );
std::string strFileName;
if(doc.Create() == false)
{
_ASSERT(0);
return false;
}
strFileName = strPath;
strFileName += "/";
strFileName += lpszFileName;
if(doc.Load( const_cast<char *>(strFileName.c_str()) ) == false)
{
_ASSERT(0);
return false;
}
IXMLDOMNodeList *pList = doc.SelectNodeList(XML_PROP_LIST_ELEMENT);
IXMLDOMNode* pNode = NULL;
char szBuffer[1024];
long lNum;
pList->get_length(&lNum);
for(long i = 0; i < lNum ; ++i)
{
pList->get_item(i,&pNode);
if(!doc.GetTextWithAttributeName(pNode, XML_PROP_LIST_ELEMENT_NAME_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
{
_ASSERT(0);
return false;
}
strFileName = strPath + "/" + szBuffer;
if( LoadProperty( strFileName.c_str() ) == false )
{
_ASSERT(0);
return false;
}
if(pNode)
{
pNode->Release();
pNode = NULL;
}
}
if(pList)
{
pList->Release();
pList = NULL;
}
return true;
}