Print Page | Close Window

CXTPPropExchangeXMLNode What am i doing wrong

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=20351
Printed Date: 18 June 2025 at 7:48am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPPropExchangeXMLNode What am i doing wrong
Posted By: schwinn
Subject: CXTPPropExchangeXMLNode What am i doing wrong
Date Posted: 29 November 2012 at 11:44am
http://forum.codejock.com/uploads/5155/Experiments.zip - uploads/5155/Experiments.zip
 
Hi All
 
What am i doing wrong?
I cannot get my code to read the attributes within my Experiment Nodes. I have included my XML file and here is my code. Any help please but not to suggest the sample application because this has a parent Node called Item and its child nodes are called Item.
 
So my code is....
 
BOOL StandardTreeCtrlDlg::OnInitDialog()
{
 CDialogEx::OnInitDialog();
 CXTPPropExchangeXMLNode px(TRUE, 0, _T("ExperimentExplorer"));   // To serialize to XML file
 if (px.LoadFromFile(L"C:\\Experiments.xmlw"))
 {
  HTREEITEM hItem = m_Tree.InsertItem(_T("My Experiments"), 0, 0);
  CXTPPropExchangeSection sec(px.GetSection(_T("Experiments")));
  DoExchangeTree(&sec, hItem);
 } 
 return TRUE;  // return TRUE unless you set the focus to a control
 // EXCEPTION: OCX Property Pages should return FALSE
}

void StandardTreeCtrlDlg::DoExchangeTree(CXTPPropExchange* pPX, HTREEITEM hItemRoot)
{
 if (pPX->IsStoring())
 {
 }
 else
 {

  CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator( _T("Experiment")));
  POSITION pos = pEnumerator->GetPosition(0);
  while (pos)
  {
     
   CString strText;
   PX_String(pPX, _T("Name"), strText); // gets nothing
   CXTPPropExchangeSection sec(pEnumerator->GetNext(pos));
   PX_String(pPX, _T("Name"), strText); // still gets nothing
   HTREEITEM hItemChild = m_Tree.InsertItem(str, 0,0, hItemRoot);
   DoExchangeTree(&sec, hItemChild);
  }
  
 }
}
 
Thanks for any help
 



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