State of Plugin Instance to Xml, what am i doing wrong?

Im trying to save in a xml file the parameters of a plugin instance that i have in the graph as node number 5:

		MemoryBlock myBlock;
		graph->getNode(5)->getProcessor()->getStateInformation(myBlock);
		ScopedPointer <XmlElement> paramsXmlElement(graph->getNode(5)->getProcessor()->getXmlFromBinary(myBlock.getData(), myBlock.getSize()));
		paramsXmlElement->writeToFile(File("C:\\MyDirectory\\params.xml"), String::empty);

i get an xml with random garbage written, what am i doing wrong?
thx in advance

EDIT:
Ok im stupid, i guess that random garbage is the Hex representation of the file, so the question that i should really is if there is a way to create the actual file with the infos contained?

What does your getStateInformation function look like? What do you see if you do

DBG (paramsXmlElement->createDocument (""));

?

Hi t0m thx for answering, the result of that is exactly how the xml get saved:

<VST3PluginState>
  <IComponent>3243.VMGcWA...f....P......LzXtsD..vvjFIzPnA...HfTXMUL.D..E...................................................................................................................................................................................KruUCISH1t...viTkEFdoMWRDABbgcVYekFY8HRLh3COPEjTA0DHoQVOhbFauIVXr8UZt8EakYWYrIBH1EFa0UVOhLiKxjSN4jSN4TiLyDiMxfCMwbSN2HxK9vCTAIUPMARZj0iHmw1ahEFae8Vcz8EakYWYrIBH1EFa0UVOhTiHu3COPEjTA0DHoQVOhDVav8Ebx81YxEVah.hcgwVck0iHvHxK9vCTAIUPMARZj0iHmEFck80atIBH1EFa0UVOh.iHu3COPEjTA0DHoQVOhbVXzU1Wnk2bzUlbkMWZyIBH1EFa0UVOh.iK0HxK9vCTAIUPMARZj0iHmEFck8EcnIWYyg1arQlHfXWXrUWY8HBLtTiHu3COPEjTA0DHoQVOhbVXzU1WxUFakE1bkIBH1EFa0UVOh.iK0HxK9vCTAIUPMARZj0iHmEFck8UXzQWXislHfXWXrUWY8HBLtTiHu3COPEjTA0DHoQVOhLGcu0Fbv70atIBH1EFa0UVOh.iHu3COPEjTA0DHoQVOhLGcu0Fbv7EbxU1byUmbkIBH1EFa0UVOhDiHu3COPEjTA0DHoQVOhLGcu0Fbv70cgg1WwIBH1EFa0UV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L1HxK9vCTAIUPMARZj0iHjUFagk2WskFdh.hcgwVck0iH13BL4jSN4jSNvPiMyHSM1fyL0jCMh7hO7.UPRETSfjFY8Hxa1I2bg0Fbrklam8Ec4AWYh.hcgwVck0iHwHxK9vCTAIUPMARZj0iHyQWYxU1aeAmbuMlHfXWXrUWY8HBLh7hO77hTkEFdoMWRD4C...........fRUMTQPIWZ1EFckQTXzEF.ADfP4AWXyMG.ADv..zA.........JU0PEAkboYWXzUFQgQWX</IComponent>
</VST3PluginState>

seems to be the file representation opened through a Hex editor, i tried to feed another MemoryBlock with that string and give it to the setStateInformation function and it actually restore correctly the parameters, so it’s really keeping the parameters informations, so for the purpose of saving a preset it still work, but i was wondering if from the getStateInformation you can get an xml file were you can actually read the single parameters inside, thx again

Oh, I has assumed this was your plug-in.

In general plug-ins are free to serialise their state however they wish and there’s no requirement for the serialisation to be readable by any other bit of code. In most cases an opaque binary blob, as you’re already seeing, is all you will be able to get.

I see, anyway it still serve the purpose of saving presets in a file, when i wrote the post i thought something was wrong because of that random text, but since it’s nothing random but it’s really keeping the parameters state and i can recall that string back through a loading preset button it’s perfect, doesn’t matter that i don’t understand it, important is that the plugin understand it :smiley:
thx again :slight_smile: