O'Reilly logo

Cocos2d Cross-Platform Game Development Cookbook - Second Edition by Siddharth Shekar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading the XML file data

We will first discuss how to simply load an XML file. We will later consider how to add data back into an XML file.

Getting started

For this chapter, I created a new project called Data, and all the necessary files can be found in the Resources folder of this chapter. The project file is also included in the code resource for the chapter, so if you get stuck anywhere, you can refer to it for clarification.

To load an XML file, we first need to have an XML file to work with. For this, I included the GroupList.xml file. Import this file into the project.

The file can be viewed in Xcode. Click on the file to see it in the navigator, as follows:

<Group> <Player> <Name>Siddharth</Name> <Level>1</Level> </Player> <Player> <Name>Alice</Name> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required