RibbonControl 转 XML树

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wangtao510/article/details/53336050

string attrName="Name';
string PagesNode="Pages";
string RibbonNode="Ribbon";
string GroupsNode="Groups";
string ItemNode="Items";

XmlDocument doc=new XmlDocument();
XmlDeclaration dec=doc.CreateXmlDeclaration("1.0","GB2312",null);
doc.AppendChild(dec);
XmlElement Robbon=doc.CreateElement(RibbonNode);
doc.AppendChild(Robbon);

for(int i=0;i<fRorm.Pages.Count;i++)
{
    XmlElement Pages=doc.CreateElement(PagesNode);
    Pages.SetAttribute(attrName,fRorm.Pages[i].Name);
    for(int k=0;k<fRorm.Pages[i].Groups.Count;i++)
    {
  
        XmlElement Groups=doc.CreateElement(PagesNode);
        Groups.SetAttribute(attrName,fRorm.Pages[i].GroupsName);
         for(int b=0;b<fRorm.Pages[i].Groups[i].ItemLinks.Count;b++)
        {
             string itermName=ItemsLink[b].iIem.Name; 
             XmlElement iItem=doc.CreateElement(PagesNode);
             iItem.SetAttribute(attrName,itermName);
             Groups.AppendChild(item);
         }
         Pages.AppenChild(Groups);
}

Ribbon.AappendChild(Pages);
}

doc.Save();


猜你喜欢

转载自blog.csdn.net/wangtao510/article/details/53336050