Esempio n. 1
0
        private static Dictionary <string, object> parseDictionary(XmlNode node)
        {
            XmlNodeList childNodes = node.ChildNodes;

            if (childNodes.Count % 2 != 0)
            {
                throw new DataMisalignedException("Dictionary elements must have an even number of child nodes");
            }
            Dictionary <string, object> strs = new Dictionary <string, object>();

            for (int i = 0; i < childNodes.Count; i += 2)
            {
                XmlNode itemOf   = childNodes[i];
                XmlNode xmlNodes = childNodes[i + 1];
                if (itemOf.Name != "key")
                {
                    throw new ApplicationException("expected a key node");
                }
                object obj = Plist.parse(xmlNodes);
                if (obj != null)
                {
                    strs.Add(itemOf.InnerText, obj);
                }
            }
            return(strs);
        }
Esempio n. 2
0
        private static List <object> parseArray(XmlNode node)
        {
            List <object> objs = new List <object>();

            foreach (object childNode in node.ChildNodes)
            {
                object obj = Plist.parse((XmlNode)childNode);
                if (obj == null)
                {
                    continue;
                }
                objs.Add(obj);
            }
            return(objs);
        }
Esempio n. 3
0
 private static object readXml(XmlDocument xml)
 {
     return(Plist.parse(xml.DocumentElement.ChildNodes[0]));
 }