Understanding the XML file

We've been working with XML many times over the course of this book. Any time we needed to change project settings, we had edited the Project.xml file. Now we're going to see how to use our own XML file.

The strings.xml file will allow us to change all text in the game from one spot, so if there's a typo somewhere, you won't have to hunt through the codebase to find it. This will also make it easier to translate the game into another language, as you can swap out the XML with a translated version very quickly.

Looking at the file's contents

Let's have a look at the strings.xml file to see what's in it:

<?xml version="1.0" encoding="utf-8" ?> <data> <string id="TAP_TO_START"><![CDATA[- TAP TO START -]]></string> <string id="HEALTH"><![CDATA[HEALTH: ...

Get Haxe Game Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.