Home » Community » Newbie corner » How to store a vector to an XML file with named items?
Re: How to store a vector to an XML file with named items? [message #46812 is a reply to message #46692] |
Tue, 16 August 2016 11:03  |
cbpporter
Messages: 1427 Registered: September 2007
|
Ultimate Contributor |
|
|
sergeynikitin wrote on Wed, 13 July 2016 12:46Use Xmlize function and .List("xxx","yyy",zzz) in it for Vectors and Arrays.
Thank you!
I had to wait until next release to update the format.
But I still can't manage to get it to work.
StoreAsXMLFile(methods, "methods", curDir + "buildMethods.xml");
The code above created an xml with a root "methods" and items called "item".
I tried this instead:
class BuilMethodXml {
public:
BuilMethodXml(Vector<BuildMethod>& meth): methods(meth) {
}
void Xmlize(XmlIO& xml) {
xml.List("methods", "method", methods);
}
private:
Vector<BuildMethod>& methods;
};
BuilMethodXml m(methods);
StoreAsXMLFile(m, "methods", curDir + "buildMethods.xml");
This doesn't work, because it creates a root called "methods" with a tag methods in it and items called "method".
I guess I need to give up on Xmlize and manually parse the Xml.
|
|
|
Goto Forum:
Current Time: Wed Apr 30 16:19:47 CEST 2025
Total time taken to generate the page: 0.01080 seconds
|