123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Xml;
- public class ResourcesXMLReader :MonoBehaviour {
-
- static ResourcesXMLReader instance;
- public static ResourcesXMLReader Instance
- {
- get
- {
- return instance;
- }
- set
- {
- instance = value;
- }
- }
- private void Awake()
- {
- instance = this;
- // ReadData();
- }
- public XmlNodeList ReadData(string XMLName, string XMLSearchingNode)
- {
- XmlDocument xml = new XmlDocument();
- TextAsset textAsset = (TextAsset)Resources.Load(XMLName);
- xml.LoadXml(textAsset.text); // suppose that myXmlString contains "<Names>...</Names>"
- XmlNodeList xmList = xml.SelectNodes(XMLSearchingNode/*"/Tweets/Tweet"*/);
- return xmList;
- }
- }
|