Click here to Skip to main content
16,016,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got an application in mfc for displaying xml node in listcontrol using msxml.
if i have the xml as follows

<hospital>
<patient>
<name>a
<place>zzz

<patient>
<name>vv
<place>bbb



My que is that i have to display first name and place in one list control and second name and place in another list control.How can i access next name and place using msxml node...
Posted
Updated 23-May-11 20:17pm
v3
Comments
CPallini 24-May-11 4:13am    
That's not XML.

if i use next sibling method in a for loop i wiil get all text nodes in single list control.i have to display one place and name in one list control and another in 2nd list control.my code as follows....


  MSXML2::IXMLDOMElementPtr m_pDocRoot;
  MSXML2::IXMLDOMNodePtr pChild = m_pDocRoot->firstChild;
  DisplayChildren(pChild);

 void CPatientInformationDlg::DisplayChildren(MSXML2::IXMLDOMNodePtr pParent)
 {
      DisplayChild1(pParent);
 }
 void CPatientInformationDlg::DisplayChild1(MSXML2::IXMLDOMNodePtr  pChild)
 {
  MSXML2::IXMLDOMNodePtr pChild1;
  for ( pChild1= pChild->firstChild;
      NULL != pChild1;
      pChild1 = pChild1->nextSibling)
  {
      VARIANT v;
      v=pChild1->nodeTypedValue;
      m_Llist2.InsertItem(0,v.bstrVal);
  }

}
plzzz if anyone know this ans plzzzzzzzz tell ans with example code....
 
Share this answer
 
v2
I am assuming you are having a IXMLDOMNode then simply use nextSibling method.
 
Share this answer
 
Comments
Ashmal Batool 14-Nov-23 4:49am    
next Node = ptr;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900