Print Page | Close Window

CXTPPropExchangeXMLNode how to traverse all nodes?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4431
Printed Date: 10 November 2025 at 5:58pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPPropExchangeXMLNode how to traverse all nodes?
Posted By: dmunoz
Subject: CXTPPropExchangeXMLNode how to traverse all nodes?
Date 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.




Replies:
Posted By: WindFlashing
Date Posted: 18 June 2006 at 10:05pm

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);
 //...
  }


Posted By: dmunoz
Date Posted: 19 June 2006 at 7:38am
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.
 


Posted By: Oleg
Date Posted: 19 June 2006 at 7:57am
Hi,
 
You don't need to access CXTPPropExchangeXMLNode members.
 
Check this sample: http://forum.codejock.com/uploads/20060619_075701_PropExchangeSam.zip - PropExchangeSam.zip


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: dmunoz
Date Posted: 19 June 2006 at 8:49am
Ah !
That is the sample I needed !

Now I understand better how to read the XML data.

Thanks Oleg.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net