# Is there an XML Writer in unreal?

**URL:** <https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707>\
**Category:** C++\
**Tags:** unreal-engine, xml, CPP, question\
**Created:** [June 14, 2016, 5:37am UTC](https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707 "2016-06-14T05:37:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ionbordura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ionbordura](https://forums.unrealengine.com/u/ionbordura)\
**Post date:** [June 14, 2016, 5:37am UTC](https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707/1 "2016-06-14T05:37:48Z")

</div>

Hi there,

Is there an XML Document writer in Unreal Engine?

Thanks!

EDIT:

Seems like it is not possible for now, I added a feature request for it: [https://answers.unrealengine.com/questions/453762/feature-request-xml-writer-exporter.html](https://answers.unrealengine.com/questions/453762/feature-request-xml-writer-exporter.html)

---

<div class="post-metadata">

**Author:** ![Jerry.Richards](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jerry.Richards](https://forums.unrealengine.com/u/Jerry.Richards)\
**Post date:** [June 14, 2016, 1:03pm UTC](https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707/2 "2016-06-14T13:03:04Z")

</div>

If you haven’t found it yet there are a few classes you can look at:

```
FXmlFile* xmlFile = new FXmlFile();
if (xmlFile == nullptr)
    return;

FXmlNode* xmlRoot = xmlFile->GetRootNode();
if (xmlRoot == nullptr)
    return;

FXmlAttribute* xmlAttribute = new FXmlAttribute(TEXT("Name"), TEXT("MyGame"));
if (xmlAttribute == nullptr)
    return;

xmlRoot->SetContent(TEXT("Game"));

xmlFile->Save(filename);
xmlFile->Clear();

delete xmlAttribute;
delete xmlFile;

```

---

<div class="post-metadata">

**Author:** ![ionbordura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ionbordura](https://forums.unrealengine.com/u/ionbordura)\
**Post date:** [June 16, 2016, 7:55am UTC](https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707/3 "2016-06-16T07:55:57Z")

</div>

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](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);
```

---

<div class="post-metadata">

**Author:** ![dgiangrave](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dgiangrave](https://forums.unrealengine.com/u/dgiangrave)\
**Post date:** [October 12, 2018, 9:07pm UTC](https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707/4 "2018-10-12T21:07:01Z")

</div>

What id the point of the FXmlAttribute here? You create it but then can never do anything with it. The return type of GetAttributes on a node is const and there is no add attribute. This confuses me because a node has a TArray of attributes but only ever can hold one. Is there any way to add an attribute to a node?

---

<div class="post-metadata">

**Author:** ![luochuanyuewu](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/luochuanyuewu/32/1156014_2.png) [@luochuanyuewu](https://forums.unrealengine.com/u/luochuanyuewu)\
**Post date:** [December 5, 2018, 4:57pm UTC](https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707/5 "2018-12-05T16:57:05Z")

</div>

Or you can checkout this plugin.

> **[Tiny Xml Integration in Code Plugins - UE Marketplace](https://www.unrealengine.com/marketplace/en-US/product/tiny-xml-integration)**
>
> This plugin provides you rich blueprint nodes to manipulate XML data.

---

<div class="post-metadata">

**Author:** ![Lolukok](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lolukok](https://forums.unrealengine.com/u/Lolukok)\
**Post date:** [August 14, 2020, 4:00pm UTC](https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707/6 "2020-08-14T16:00:45Z")

</div>

Two years later, same Question! Did you by any chance find a solution to this? (how to add an attribute to a node)

---

<div class="post-metadata">

**Author:** ![alf4712](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alf4712/32/759640_2.png) [@alf4712](https://forums.unrealengine.com/u/alf4712)\
**Post date:** [January 10, 2024, 11:33am UTC](https://forums.unrealengine.com/t/is-there-an-xml-writer-in-unreal/360707/7 "2024-01-10T11:33:01Z")

</div>

> **[XmlParser](https://docs.unrealengine.com/5.3/en-US/API/Runtime/XmlParser/)**
