private void xml()
{
DataSet ds = ProdTypeManager.GetList(" t_type=2 and t_prenID=0");
XmlDocument doc = new XmlDocument();
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(dec);
XmlElement root = doc.CreateElement("data");
doc.AppendChild(root);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
XmlElement cmenu = doc.CreateElement("cmenu");
XmlAttribute cnname = doc.CreateAttribute("cnname");
cnname.Value = ds.Tables[0].Rows[i]["t_title"].ToString();
cmenu.Attributes.Append(cnname);
XmlAttribute link = doc.CreateAttribute("link");
link.Value = "shop_list?typeID=" + ds.Tables[0].Rows[i]["t_id"].ToString();
// cmenu.Attributes.Append(link);
root.AppendChild(cmenu);
// doc.AppendChild(cmenu);
DataSet ds1 = ProdTypeManager.GetList(" t_type=2 and t_prenID="+ds.Tables[0].Rows[i]["t_id"].ToString());
for (int j = 0; j < ds1.Tables[0].Rows.Count; j++)
{
XmlElement bdment = doc.CreateElement("bdment");
XmlAttribute cnname1 = doc.CreateAttribute("cnname");
cnname1.Value = ds1.Tables[0].Rows[j]["t_title"].ToString();
bdment.Attributes.Append(cnname1);
XmlAttribute link1 = doc.CreateAttribute("link");
link1.Value = "shop_list?typeID=" + ds1.Tables[0].Rows[j]["t_id"].ToString();
bdment.Attributes.Append(link1);
// root.AppendChild(bdment);
cmenu.AppendChild(bdment);
DataSet ds2 = ProdTypeManager.GetList(" t_type=2 and t_prenID=" + ds1.Tables[0].Rows[j]["t_id"].ToString());
for (int k = 0; k < ds2.Tables[0].Rows.Count; k++)
{
XmlElement ddment = doc.CreateElement("ddment");
XmlAttribute cnname2 = doc.CreateAttribute("cnname");
cnname2.Value = ds2.Tables[0].Rows[k]["t_title"].ToString();
ddment.Attributes.Append(cnname2);
XmlAttribute link2 = doc.CreateAttribute("link");
link2.Value = "shop_list?typeID=" + ds2.Tables[0].Rows[k]["t_id"].ToString();
ddment.Attributes.Append(link2);
// root.AppendChild(ddment);
bdment.AppendChild(ddment);
}
}
}
string xmlString = doc.OuterXml;
doc.Save(Server.MapPath("../../xml/hassssh.xml"));
{
DataSet ds = ProdTypeManager.GetList(" t_type=2 and t_prenID=0");
XmlDocument doc = new XmlDocument();
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(dec);
XmlElement root = doc.CreateElement("data");
doc.AppendChild(root);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
XmlElement cmenu = doc.CreateElement("cmenu");
XmlAttribute cnname = doc.CreateAttribute("cnname");
cnname.Value = ds.Tables[0].Rows[i]["t_title"].ToString();
cmenu.Attributes.Append(cnname);
XmlAttribute link = doc.CreateAttribute("link");
link.Value = "shop_list?typeID=" + ds.Tables[0].Rows[i]["t_id"].ToString();
// cmenu.Attributes.Append(link);
root.AppendChild(cmenu);
// doc.AppendChild(cmenu);
DataSet ds1 = ProdTypeManager.GetList(" t_type=2 and t_prenID="+ds.Tables[0].Rows[i]["t_id"].ToString());
for (int j = 0; j < ds1.Tables[0].Rows.Count; j++)
{
XmlElement bdment = doc.CreateElement("bdment");
XmlAttribute cnname1 = doc.CreateAttribute("cnname");
cnname1.Value = ds1.Tables[0].Rows[j]["t_title"].ToString();
bdment.Attributes.Append(cnname1);
XmlAttribute link1 = doc.CreateAttribute("link");
link1.Value = "shop_list?typeID=" + ds1.Tables[0].Rows[j]["t_id"].ToString();
bdment.Attributes.Append(link1);
// root.AppendChild(bdment);
cmenu.AppendChild(bdment);
DataSet ds2 = ProdTypeManager.GetList(" t_type=2 and t_prenID=" + ds1.Tables[0].Rows[j]["t_id"].ToString());
for (int k = 0; k < ds2.Tables[0].Rows.Count; k++)
{
XmlElement ddment = doc.CreateElement("ddment");
XmlAttribute cnname2 = doc.CreateAttribute("cnname");
cnname2.Value = ds2.Tables[0].Rows[k]["t_title"].ToString();
ddment.Attributes.Append(cnname2);
XmlAttribute link2 = doc.CreateAttribute("link");
link2.Value = "shop_list?typeID=" + ds2.Tables[0].Rows[k]["t_id"].ToString();
ddment.Attributes.Append(link2);
// root.AppendChild(ddment);
bdment.AppendChild(ddment);
}
}
}
string xmlString = doc.OuterXml;
doc.Save(Server.MapPath("../../xml/hassssh.xml"));
}