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
|