BBGamelib.NSCollectionUtils.ParseArray C# (CSharp) Method

ParseArray() public static method

public static ParseArray ( XmlNode node ) : NSArray
node System.Xml.XmlNode
return NSArray
		public static NSArray ParseArray(XmlNode node)
		{
			NSArray array = new NSArray();
			int count = node.ChildNodes.Count;
			for (int i = 0; i < count; i++) {
				object result = Parse(node.ChildNodes[i]);
				if (result != null)
				{
					array.Add(result);
				}		
			}
            return array;
        }
        

Usage Example

        public static NSArray ArrayWithContentsOfString(string text)
        {
            if (text == null)
            {
                return(null);
            }
            text = System.Text.RegularExpressions.Regex.Replace(text, "<.*\\.dtd\">", string.Empty);

            XmlReaderSettings settings = new XmlReaderSettings();

            settings.ProhibitDtd    = false;
            settings.ValidationType = ValidationType.None;
            XmlDocument xmlDoc = new XmlDocument();

            using (StringReader sr = new StringReader(text))
                using (XmlReader reader = XmlReader.Create(sr, settings))
                {
                    xmlDoc.Load(reader);
                }

//			XmlDocument xmlDoc = new XmlDocument();
//			xmlDoc.LoadXml (text);

            XmlNode rootNode = xmlDoc.DocumentElement.ChildNodes[0];

            if (rootNode.Name != "array")
            {
                return(null);
            }
            return(NSCollectionUtils.ParseArray(rootNode));
        }