![]() |
CXTPPropExchangeXMLNode how to traverse all nodes? |
Post Reply ![]() |
Author | |
dmunoz ![]() Newbie ![]() Joined: 18 June 2006 Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() Posted: 18 June 2006 at 8:53am |
Hi,
I'm evaluating Xtreme TookitPro and so far I'm quite happy with what I've try. I'm baffled by something though. I need to read/write some dynamic content in XML, and what hoping to use for that CXTPPropExchangeXMLNode. But I can't figure how to traverse all nodes after a LoadFromFile ! If I know the node names, I understand I can do it with CXTPPropExchangeSection or GetEnumerator, but how if I don't know the names, and I need to traverse all the XML tree structure node after node and read their content ? Couldn't find an example in the Sample files. Anyone care to point me in the right direction ? Thanks for any help. |
|
![]() |
|
WindFlashing ![]() Groupie ![]() Joined: 21 March 2006 Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() |
There are two ways, 1.Use CXTPPropExchangeEnumeratorPtr: CXTPPropExchangeEnumeratorPtr pEnumerator(m_pSection->GetEnumerator(_T("*")));
pos = pEnumeratorMenu->GetPosition(); while (pos) { CXTPPropExchangeXMLNode* pNode = pEnumerator->GetNext(pos)); // ...
} 2.Use m_xmlSectionNode in CXTPPropExchangeXMLNode,
UINT CPropExchangeXMLNodeEx::GetNodesCount(LPCTSTR lpszSection)
{ if (m_xmlSectionNode == NULL) { return 0; } HRESULT hr;
UINT length; IXMLDOMNodePtr xmlNodePtr; IXMLDOMNodeListPtr xmlNodeListPtr; hr = m_xmlSectionNode->selectNodes(_bstr_t(lpszSection ? lpszSection : _T("*")), (XTPXML::IXMLDOMNodeList**)&xmlNodeListPtr); //...
} |
|
![]() |
|
dmunoz ![]() Newbie ![]() Joined: 18 June 2006 Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() |
Thanks for the help, now I understand. I was able to traverse the nodes
with CXTPPropExchangeEnumeratorPtr, and retrieve each node name with
xmlSectionNode::get_nodeName.
I find strange though that there is no simple interface within the CPropExchangeXMLNode class, and that one need first to derive the class to be able to access m_xmlSectionNode protected member, then to be forced to call the COM interface to get some details about the node, like its name. Some functions within CPropExchangeXMLNode class would have been useful. Or did I miss them ? I see you have a CPropExchangeXMLNodeEx class, is that part of the XTreme Toolkit package ? Or is there something a little more elaborate planned in the Toolkit for working with XML files ? Thanks again. |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
You don't need to access CXTPPropExchangeXMLNode members.
Check this sample: PropExchangeSam.zip
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
dmunoz ![]() Newbie ![]() Joined: 18 June 2006 Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() |
Ah !
That is the sample I needed ! Now I understand better how to read the XML data. Thanks Oleg. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |