From: Christophe de V. <cde...@al...> - 2004-06-01 13:42:18
|
Daniel Holbach a écrit : >Hello everyone, > >I want to read a XML file and stick into a data structure of my own; I >need bits of it across my whole project, so passing around NodeSets >seems to be a no-go and not the appropriate option, but maybe I'm wrong. > > What makes you think it's inappropriate ? As long as your structures and your xml tree are organised in a similar way, I'd say that using xpath expressions is a bit overkill. ><snip> >I libxml2-xml-schema-validated it, got the appropriate NodeSet via > ns = rootNode->find("//datasource/descendant::*"); >and begin iterating over it: > for(xmlpp::NodeSet::iterator it=ns.begin();it!=ns.end();++it) > >The problem is, to know when which ddd-list is finished, to add it to >the bbb one. Maybe there's a clever trick and I don't see or maybe my >"design" is crap. I even appreciate flames, so thanks alot in advance. > > Either use the NodeLists, either make more precise xpath expression. Christophe |