コード例 #1
0
        public void xmlLoader(XmlTextReader read, ObjectSpace objects,String tag)
        {
            xmlObject obj = new xmlObject("dummy");
            int count = 0;
            String token = tag;
            String name = "";

            while (read.Read())
            {

                //Check if we should reset the object counter
                if (count > 0)
                {
                    objects.addObject(obj);
                    count = 0;
                }

                //Check if it is the start of a new object
                if (read.Name.Equals(token))
                {
                    obj = new xmlObject(token);
                    count++;

                }
                else if (read.NodeType == XmlNodeType.Element)
                {
                    name = read.Name;
                }
                else if (read.NodeType == XmlNodeType.Text)
                {
                    obj.addAttributes(name, read.Value);
                }

            }
            objects.checkRemoveEmpty();
        }