您好,我有一个来自 whihc 的 xml 文件,我想要其中的一部分。所以,这是我的 xml 文件:
<Item Text="Reports" Navigateurl ="Reports/Default.aspx">
<Group>
<Item Text="Customers" NavigateUrl="Reports/Customers/Default.aspx" Select="true">
<Group>
<Item Text="Customers" NavigateUrl="Reports/Customers/CustomerList.aspx"
Select="true" />
<Item Text="Customer Products"
NavigateUrl="Reports/Customers/CustomersProducts.aspx" Select="true" />
<Item Text="Customer Measurements"
NavigateUrl="Reports/Customers/CustomerLocationMeasurements.aspx"
Select="true" />
<Item Text="Customer Groups" NavigateUrl="Reports/Customers/CustomerGroups.aspx" />
<Item Text="Customer Outages"
NavigateUrl="Reports/Customers/CustomerOutages.aspx" Select="true"/>
</Group>
</Item>
为了选择这部分,我使用了这个表达式:
XmlDataSource XmlDataSource1 = new XmlDataSource();
XmlDataSource1.DataFile = "~/Menu.xml";
XmlDataSource1.XPath = "//Item[@Text ='Customers']/Group";
XmlDataSource1.DataBind();
结果将是
Group
Customers
CustomerProducts
..........
但我只想要那些选择属性为真的。但我一直无法弄清楚如何做到这一点。你能帮我么?