Thanks for the help! However as I looked over the source code one should not create a new FXmlFile without a path. You can, but then the RootNode is set to nulltpr:
/** Constructs the file without a path */
FXmlFile() : RootNode(nullptr), bFileLoaded(false) {}
Hence, the part with the GetRootNode() will return a nullptr :(.
Can it be that the API is only made for reading the XML files?
EDIT:
It can be done by creating the xml file from string (see https://answers.unrealengine.com/questions/435638/is-there-an-xml-writer-in-unreal.html):
const FString FileTemplate = "<?xml version=\"1.0\" encoding=\"UTF - 8\"?>\n<root>\n</root>";
FXmlFile * File = new FXmlFile(FileTemplate, EConstructMethod::ConstructFromBuffer);