How to display data from an external XML file?
Hello,
This is an example of the XML file I want to display:
http://beechnova.tigrimigri.com/test.xml
The file loads with no problems using this script:
using UnityEngine;
using System.Collections;
using System.Xml;
using System;
public class LoadXML : MonoBehaviour
{
IEnumerator Start()
{
//Load XML data from a URL
string url = "http://beechnova.tigrimigri.com/test.xml";
WWW www = new WWW(url);
//Load the data and yield (wait) till it's ready before we continue executing the rest of this method.
yield return www;
if (www.error == null)
{
//Sucessfully loaded the XML
Debug.Log("Loaded following XML " + www.data);
}
}
}
The problem is, I just can't seem to be able to display the text properly after it loads.
Basically, all I want to do is display the information from the XML file as "Text Mesh" in columns under their headings.
For example:
Dates: Destination: Cost:
When Where How much
It seems like it should be such a simple thing to do, and after trying various scripts and watching lots of videos on YouTube, I just can't seem to find a script that doesn't result in errors.
Hopefully someone can help me and put me out of my misery :)
Answer by Ejpj123 · Apr 11, 2016 at 11:22 PM
Maybe this will help you: http://forum.unity3d.com/threads/xml-reading-a-xml-file-in-unity-how-to-do-it.44441/