# Store level data in XML format

**URL:** <https://forums.unrealengine.com/t/store-level-data-in-xml-format/322469>\
**Category:** C++\
**Tags:** data-structures, unreal-engine, xml, CPP, question\
**Created:** [June 20, 2015, 4:46pm UTC](https://forums.unrealengine.com/t/store-level-data-in-xml-format/322469 "2015-06-20T16:46:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drakosvlad\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@drakosvlad\_1](https://forums.unrealengine.com/u/drakosvlad_1)\
**Post date:** [June 20, 2015, 4:46pm UTC](https://forums.unrealengine.com/t/store-level-data-in-xml-format/322469/1 "2015-06-20T16:46:23Z")

</div>

Hello! I am creating my 3d puzzle game and I need to store levels. I tried to use DataAsset, but I found it very uncomfortable to add new levels. I decided to use XML file to store them because it s quite simple to understand it and add a new level. I found XMLParser tutorials and understood them, but I can`t understand, how can I store this file in game package and access it from my game?  
I will be also very pleased if you provide some information about other ways of storing data. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![MiniTurtle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MiniTurtle](https://forums.unrealengine.com/u/MiniTurtle)\
**Post date:** [June 23, 2015, 1:10am UTC](https://forums.unrealengine.com/t/store-level-data-in-xml-format/322469/2 "2015-06-23T01:10:39Z")

</div>

That’s a tough one 😜

Now, I have never done this myself, and it seems like a big task, but I will try to help you anyway

If you want to do it the hard way, I think this is a good place to start looking

In …\Source\Editor\UnrealEd\Private\EditorServer.cpp

```
bool UEditorEngine::Map_Load(const TCHAR* Str, FOutputDevice& Ar)
{
  // Line 2291 for version 4.8
  ...
  {
  //Load the map normally into a new package
  const FName WorldPackageFName = FName(*LongTempFname);	
  UWorld::WorldTypePreLoadMap.FindOrAdd(WorldPackageFName) = EWorldType::Editor;
  -> WorldPackage = LoadPackage( NULL, *LongTempFname, LoadFlags );	
  UWorld::WorldTypePreLoadMap.Remove(WorldPackageFName);
  }
  ...
}

```

Slightly easier to create a class that loads the map on GameMode::BeginPlay or something:

```
#include "Engine/Level.h"

void AFoo::LoadMap(...)
{
   // Start loading map here
}

void AFoo::SaveCurrentMap()
{
   ULevel *Level = GetWorld()->GetCurrentLevel();
   if (!Level)
        return;

	for (auto Actor : Level->Actors)
	{
		// Write XML
	}

  // Level also has other things that are worth saving i.e.
// ULevelScriptBlueprint* LevelScriptBlueprint;
}
```

---

<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:** [June 5, 2018, 8:19pm UTC](https://forums.unrealengine.com/t/store-level-data-in-xml-format/322469/3 "2018-06-05T20:19:15Z")

</div>

There’s a plugin which fully support XML read/write and table mapping, it can be used in both blueprints and c++. [Tiny Xml Integration in Code Plugins - UE Marketplace](https://www.unrealengine.com/marketplace/tiny-xml-integration)
