XML属性中文件路径
来源:百度知道 编辑:UC知道 时间:2024/06/03 17:34:48
如何获得XML文件中属性中存放的路径,并将文件名赋给播放器
对ieool 表示感谢,我用VC但还是十分感谢忙中抽闲帮助我
对ieool 表示感谢,我用VC但还是十分感谢忙中抽闲帮助我
以下程式在C#下成功通过:
using System;
using System.Collections.Generic;
using System.Xml;
public class MyClass
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<elements><element attr1=\"abc\" attr2=\"asd\" attr3=\"d:\\movies\\门徒1.rmvb\\\"/><element attr1=\"abc\" attr2=\"asd\" attr3=\"d:\\movies\\门徒2.rmvb\\\"/></elements>");
Console.Write("假设你的XML文档如下:\n");
doc.Save(Console.Out);
Console.Write("\n\n");
XmlNodeList nList = doc.SelectNodes("//element");
for (int i = 0; i < nList.Count; i++)
{
Console.Write(nList[i].Attributes["attr3"].Value);//显