xml文件格式如下
<?xml version="1.0" encoding="utf-8" ?>
<Vocation>
<VocationTypeFather Value="1000" Text="请选择行业类别">
<VocationTypeSon Value="2000" Text="请选择职位类别"></VocationTypeSon>
</VocationTypeFather>
<VocationTypeFather Value="1001" Text="计算机硬件">
<VocationTypeSon Value="2001" Text="网络工程师">
<VocationTypeGrandson Value="3001" Text="布线原理"></VocationTypeGrandson>
</VocationTypeSon>
</VocationTypeFather>
</Vocation>请问,如果我知道了某个节点的Value属性,怎么样取得该节点的Text属性,请给出代码,谢谢
<?xml version="1.0" encoding="utf-8" ?>
<Vocation>
<VocationTypeFather Value="1000" Text="请选择行业类别">
<VocationTypeSon Value="2000" Text="请选择职位类别"></VocationTypeSon>
</VocationTypeFather>
<VocationTypeFather Value="1001" Text="计算机硬件">
<VocationTypeSon Value="2001" Text="网络工程师">
<VocationTypeGrandson Value="3001" Text="布线原理"></VocationTypeGrandson>
</VocationTypeSon>
</VocationTypeFather>
</Vocation>请问,如果我知道了某个节点的Value属性,怎么样取得该节点的Text属性,请给出代码,谢谢
解决方案 »
- httpwatch 在IE 中无法显示
- js跳转问题
- 如何读取rss
- 一个关于如何修改数据库中的order_id字段的问题,可以解决吗?
- 急!DataGrid里update时,为什么不激活ItemCommand事件?
- 页面多次提交的问题----在线等,谢谢!(顶有分)
- 菜鸟求助?请问:在下拉列表框中的 选项值 和 选项文字 是从数据库里读出来的,怎么样实现?
- 数据访问库问题!请懂的朋友指导
- 存储过程高手在哪里,高手在哪里啊?实在头大了,受不了了!高分相送
- .net最常见问题,懂得服务器配置的大请进,问题解决就送分
- 页面中修改全局变量的值
- [求助]关于COOKIE,如果某网站创建了一个COOKIE,我在本地做的网站能读取么?谢谢,在线等
string strText="";
XmlTextReader xr = new XmlTextReader(Server.MapPath(null)+"\\test.xml");
xr.MoveToAttribute("Vocation");
while(xr.Read())
{
if(xr.Name.Equals("VocationTypeFather"))
{
if (xr.GetAttribute("Value")=="1000")
{
strText = xr.GetAttribute("Text");
break;
}
}
}
xr.Close();