CXmlMenu'�Display Menus from XML Files
Posted
by John Melas
on November 20th, 2003
Environment: VC6
This article covers the need for the dynamic creation of menus from XML files. Menus represent tree data structures exactly as XML files do. In case you have some data stored in an XML file and you want to select a specific item from it, wouldn't it be nice to have something like this:
CXmlMenu menu;
//display the menu and get user selection
CString answer = menu.TrackXml(this,"example.xml","name");
if (answer!="")
MessageBox("You selected \"" + answer + "\"");
This is exactly what the CXmlMenu class does. It can create a menu by reading a specific attribute of the items of an XML file (attribute "name" is selected in the example above); it displays the menu and returns the attribute of the selected item.
The code for XML file handling is taken from Pablo van der Meer.
Downloads
Download demo project - 129 KbDownload source - 6 Kb

Comments
Plz help me
Posted by rindam2002 on 06/04/2007 05:54amI am being unamble to create menu from an xml file which I am loading through its url.why?plz help me out.its really urgent.
ReplyPlz help me
Posted by rindam2002 on 06/04/2007 05:52amI am being unamble to create menu from an xml file which I am loading through its url.why?plz help me out.its really urgent.
ReplyHelp Required Urgently
Posted by shash123 on 11/16/2006 05:24amPlease help me out.I posted the question yesterday also. I want to read an XML file from a web location by specifying its URL, but I am not able to do so through this program. Please reply me as soon as possible. Thanks in Advance
-
Replyreading xml file from a web location is solved
Posted by rindam2002 on 06/05/2007 01:17amHi shashank I was also having the same problem but I have solved it now...Just copy the bellow code in place of load function and enjoy. MSXML::IXMLDOMDocumentPtr pDOMDoc(__uuidof (MSXML::DOMDocument)); m_plDomDocument = pDOMDoc; pDOMDoc->put_async(VARIANT_FALSE); VARIANT_BOOL vResult1 = pDOMDoc->load(_variant_t(bstrFileName1)); if (VARIANT_FALSE == vResult1) { // Load failed MSXML::IXMLDOMParseErrorPtr pParseError = pDOMDoc->GetparseError(); long dwError = pParseError->GeterrorCode(); _bstr_t bstrReason = pParseError->Getreason(); CString strError; strError.Format(_T("XML Parse Error 0x%x : %s"), dwError, W2T(bstrReason)); MessageBox(strError); }
ReplyReading XML file from a web location.....
Posted by shash123 on 11/14/2006 11:50pm-
Replyreading xml file from a web location
Posted by rindam2002 on 06/04/2007 05:48amhi I am also facing the same problem.I am unable to read any XML file if a provided its URL instead of the local disk path.Plz tell me how to do it?
Replygood
Posted by dwoseven on 06/19/2004 02:46pmgood program
ReplyLittle bug
Posted by Legacy on 11/25/2003 12:00amOriginally posted by: emilio_g
-
-
Replysome code...
Posted by Michael Klim on 08/15/2004 11:28amHi Could you please post the code here or update the application, because I have really big problems implementing the hints of emilio... Thanks in advance, Michael
Replythanks!
Posted by jmelas on 08/05/2004 05:00amThe code for XmlDocument is not mine but I found also this bug when I installed VC7.0! Thanks for the correction!
ReplyGreat program!!
Posted by Legacy on 11/20/2003 12:00amOriginally posted by: Raul Assis
Great program!! It worked very well. Now it would be great to expand the program not only to display the contents of xml files but to enable editing.
Reply