Create XML file without template

Hello!

I am currently working with the XmlParser and there doesn’t seem to be a way to create a xml file from scratch. You need some kind of XmlNode as a start to add new nodes, but when you create a XmlFile without loading an actual file GetRootNode() will always return NULL making it impossible to add content.
Is there any workaround for this or maybe a function I am missing?

Thanks!

Nevermind I got it working.
Instead of setting the File parameter to an actual path you can simply insert the content of your template file as a string like so:

const FString FileTemplate = "<?xml version=\"1.0\" encoding=\"UTF - 8\"?>\n<root>\n</root>";
	FXmlFile * File = new FXmlFile(FileTemplate, EConstructMethod::ConstructFromBuffer);

It’s important to not forget the escape characters in your template file (" and \n)!