
Istvan Buki wrote:
One of the next component I will probably develop is a something to load XML messages from a file. I'm not yet decided how I'll represent the XML data in the application. I saw that there is a fusion tree in the ext directory but I'm not sure how stable it is. Steven already helped me a while ago to understand how to work with nested fusion maps. If you have suggestions regarding this subject I would like to hear them.
BTW, you might want to check out the Spirit2 example directory. Spirit2 will be an experimental branch in the next 1.36 release and you can find it in both the boost SVN trunk and release branch. There you'll see a toy XML parser that loads its data to a struct adapted as a fusion sequence: struct mini_xml; typedef boost::variant< boost::recursive_wrapper<mini_xml> , std::string > mini_xml_node; struct mini_xml { std::string name; // tag name std::vector<mini_xml_node> children; // children }; //] // We need to tell fusion about our mini_xml struct // to make it a first-class fusion citizen BOOST_FUSION_ADAPT_STRUCT( mini_xml, (std::string, name) (std::vector<mini_xml_node>, children) ) After adapting the mini_xml struct, I was able to work on it just like any fusion sequence. There's some docs (tutorials) in there detailing this. Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net