我 现在需要显示的 Xml数据是 sta=1 并且 Xml行gongcai[i]数组 返回1 的 那个XML行。再绑定到datalist中
DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "sta<>0";
//- string path1 = Server.MapPath("~");
string all_path = path1 + @"\App\shopinfo.xml";
XmlDataDocument xml_ = new XmlDataDocument();
xml_.Load(all_path);
XmlNodeList xnl = xml_.SelectSingleNode("shopinfo").ChildNodes; string standtime = ""; foreach (XmlNode xn in xnl)
{
standtime = xn.Attributes["opentime"].Value + "," + xn.Attributes["opentime1"].Value + "," + xn.Attributes["opentime2"].Value + "," + xn.Attributes["opentime3"].Value + ",";
}
xml_.Save(all_path);
string[] stand_ = standtime.Split(',');//饭店开业时间
//-
string comtime = "";
foreach (XmlNode cn in xnll)
{
comtime = cn.Attributes["opentime"].Value;
int ii =0;
string[] gongcai = comtime.Split(','); //菜供应时间范围
for (int i = 0; i < gongcai.Length; i++)
{
ii = check(gongcai[i]);
}
if (ii >0)
{
//dv.RowStateFilter = @"opentime<>'"+comtime+"'";
}
}
DataList1.DataSource = dv; //绑定后显示小菜
DataList1.DataBind();
}
xml_che.Save(map);// check返回 素组有符合条件的 check 返回1Xml格式 <Product id="1_12" name="12" image="" detail="12" suoxie="12" opentime="12:00:00--13:00:00,12:00:00--15:12:00,12:00:00--14:00:00," sta="1" />
DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "sta<>0";
//- string path1 = Server.MapPath("~");
string all_path = path1 + @"\App\shopinfo.xml";
XmlDataDocument xml_ = new XmlDataDocument();
xml_.Load(all_path);
XmlNodeList xnl = xml_.SelectSingleNode("shopinfo").ChildNodes; string standtime = ""; foreach (XmlNode xn in xnl)
{
standtime = xn.Attributes["opentime"].Value + "," + xn.Attributes["opentime1"].Value + "," + xn.Attributes["opentime2"].Value + "," + xn.Attributes["opentime3"].Value + ",";
}
xml_.Save(all_path);
string[] stand_ = standtime.Split(',');//饭店开业时间
//-
string comtime = "";
foreach (XmlNode cn in xnll)
{
comtime = cn.Attributes["opentime"].Value;
int ii =0;
string[] gongcai = comtime.Split(','); //菜供应时间范围
for (int i = 0; i < gongcai.Length; i++)
{
ii = check(gongcai[i]);
}
if (ii >0)
{
//dv.RowStateFilter = @"opentime<>'"+comtime+"'";
}
}
DataList1.DataSource = dv; //绑定后显示小菜
DataList1.DataBind();
}
xml_che.Save(map);// check返回 素组有符合条件的 check 返回1Xml格式 <Product id="1_12" name="12" image="" detail="12" suoxie="12" opentime="12:00:00--13:00:00,12:00:00--15:12:00,12:00:00--14:00:00," sta="1" />
----
这是什么意思
建议楼主把完整XML发上来看,再认真描述下需求.