本帖最后由 sin5571 于 2013-05-26 18:16:18 编辑

解决方案 »

  1.   

    那是.net里xml的标准格式,想写自己的格式就直接用字符串然后写文件吧。
      

  2.   

    而且这不是自己的格式,是xml 1.0文档里就用的这种格式啊,.NET不就是支持xml 1.0么
      

  3.   

                        unit_element.InnerText = "";
                        group_element.AppendChild(unit_element);
      

  4.   

            public bool Save(string file_name)
            {
                XmlDocument writer = new XmlDocument();
                writer.AppendChild(writer.CreateXmlDeclaration("1.0", "utf-8", null));
                XmlElement root = writer.CreateElement("动作集合");
                writer.AppendChild(root);
                Debug.Log(group_list.Count);
                for (int i = 0; i < group_list.Count;i++ )
                {
                    ActGroup act_group = group_list[i];
                    XmlElement group_element = writer.CreateElement("动作组");
                    group_element.SetAttribute("标签", act_group.tag);
                    group_element.SetAttribute("技能ID",act_group.skill_id.ToString());
                    root.AppendChild(group_element);
     
                    for (int j = 0; j < act_group.act_list.Count;j++ )
                    {
                        ActUnit act_unit = act_group.act_list[j];
                        XmlElement unit_element = writer.CreateElement("动作单元");
                        unit_element.SetAttribute("编号", act_unit.id.ToString());
                        unit_element.SetAttribute("动作名称", act_unit.act_name);
                        unit_element.InnerText = "";
                        group_element.AppendChild(unit_element);
                    }
                    
                }
                
                writer.Save(file_name);
                return true;
            }
      

  5.   

    可以查一下XmlWriterSetting ,这里边有xml样式的设置,具体的我记不太清楚了