<?xml version="1.0" encoding="gb2312"?>
<manifest identifier="SingleSharableResource_MulitipleFileManifest" version="1.1" xmlns="http://www.imsproject.org/xsd/imscp_rootv1p1p2" xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd
         http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd
         http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd">
<metadata/>
<organizations default="hooyes">
<organization identifier="hooyes">
<item xmlns="" identifier="B_hooyes">
<item xmlns="http://www.imsproject.org/xsd/imscp_rootv1p1p2" identifier="B_01_cnn1_1" isvisible="true">
<title>关于个人</title>
<item identifier="S_men" identifierref="R_S_men" isvisible="true">
<title>男人</title>
</item>
<item identifier="S_women" identifierref="R_S_women" isvisible="true">
<title>女人</title>
</item>
</item>
</item>
</organization>
</organizations>
<resources>
<resource identifier="R_S_men" type="webcontent" adlcp:scormtype="sco" href="unit1/index_content.html">
<metadata>
<schema>ADL SCORM</schema>
<schemaversion>1.2</schemaversion>
<adlcp:location>unit1/index_content.html</adlcp:location>
</metadata>
<file href="unit1/index_content.html"/>
<dependency identifierref="R_D_01_Contentcnn1_1_1"/>
</resource>
<resource identifier="R_S_women" type="webcontent" adlcp:scormtype="sco" href="unit2/index_content.html">
<metadata>
<schema>ADL SCORM</schema>
<schemaversion>1.2</schemaversion>
<adlcp:location>unit2/index_content.html</adlcp:location>
</metadata>
<file href="unit2/index_content.html"/>
<dependency identifierref="R_D_01_Contentcnn1_1_2"/>
</resource>

</resources>
</manifest>xml 的特征如上:
如今想通过方法  fx(xml) 
想得到如下格式数据:序号      节点名称                url
1         关于个人                0
2         男人                    unit1/index_content.html
3         女人                    unit2/index_content.html
..... 
高手能否给个实现例子.
  

解决方案 »

  1.   

    用DataSet 的Load方法 就可以了 
      

  2.   

    试过了..不行的哦,主要是有 xmlns ...
      

  3.   

    XmlDocument   selectNodes
      

  4.   

    xmlns,不关这个的事,肯定可以的
      

  5.   

    System.Xml.XmlDocument dom = new System.Xml.XmlDocument();
    dom.LoadXml(xml);
    foreach (System.Xml.XmlNode node in dom.ChildNodes)
    {   
       Response.Write(Get(node)+"<BR>"); 
    }
    string Get(System.Xml.XmlNode node)
            {
                string str = node.InnerText;
                if (node.HasChildNodes)
                {
                    str = "";
                    foreach (System.Xml.XmlNode n in node.ChildNodes)
                    {
                        str += Get(n);
                    }
                }
                return str;
            }
      

  6.   

    xmlns 只是XML命名空间.
    用XMLDocument(存入内存中读取)
    或XMLReader(只向前读取)
      

  7.   

    用XlmDocument或XMLReader
    DataSet的Load方法处理有一定的局限性(文档树不能超过三层;根元素不能有属性;根元素不能超过一个,否则多余的根元素及子元素无效),不能处理复杂的结构
      

  8.   

    Program.cs类using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Xml;namespace TestConsoleApplication
    {
        class Program
        {
            static void Main(string[] args)
            {
                Test3 te = new Test3();
                te.xmlTest();
                Console.Read();
            }        class Test3
            {
                int i = 0;
                XmlDocument myXml = new XmlDocument();
                Xml xml = new Xml();
                public void xmlTest()
                {
                    myXml.Load("E:/test.xml");
                    XmlNodeList node = myXml.DocumentElement.ChildNodes;
                    XmlNode node2 = node.Item(1);
                    foreach (XmlNode var in node2.ChildNodes)
                    {
                        foreach (XmlNode var1 in var.ChildNodes)
                        {
                            foreach (XmlNode var2 in var1.FirstChild)
                            {
                                switch (var2.Name)
                                {
                                    case "title":
                                        xml.title = var2.InnerText;
                                        break;
                                    case "item":
                                        xml.name[i] = var2.InnerText;
                                        ++i;
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }
                    }
                    int j = 0;
                    node2 = node.Item(2);
                    foreach (XmlNode var in node2.ChildNodes)
                    {
                        foreach (XmlNode var1 in var.FirstChild)
                        {
                            switch (var1.Name)
                            {
                                case "adlcp:location":
                                    xml.url[j] = var1.InnerText;
                                    ++j;
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                   
                    for (int i = 0; i < xml.url.Length; i++)
                    {
                        if (i == 0)
                        {
                            Console.Write("序号\t\t节点名称\t\tURL");
                            Console.WriteLine();
                            Console.Write(i + 1 + "\t\t" + xml.title + "\t\t0");
                        }
                        else
                        {
                            if (xml.name[i - 1] == null)
                            {
                                break;
                            }
                            Console.Write(i + 1 + "\t\t");
                            Console.Write(xml.name[i-1] + "\t\t");
                            Console.Write(xml.url[i-1] + "\t\t");
                        }
                        Console.WriteLine();
                    }
                }
            }
        }
    }Xml.cs类using System;
    using System.Collections.Generic;
    using System.Text;namespace TestConsoleApplication
    {
        public class Xml
        {
            public string title;
            public string[] name = new string[10];
            public string[] url = new string[10];
        }
    }把你的你的发的那个XML文件放到E盘跟目录下..
      

  9.   

    哎..真是郁闷哦,简单的xml操作谁都会,但是如何处理. xmlns:adlcp 
    没有人给出有用的方法.
      

  10.   

    SCORM 标准中的这个 imsmanifest.xml 看来还真有点意思.
      

  11.   

    System.Xml.XmlDocument dom = new System.Xml.XmlDocument();
    dom.LoadXml(xml);
    foreach (System.Xml.XmlNode node in dom.ChildNodes)

      Console.Write(Get(node)+" <BR>");
    }
    string Get(System.Xml.XmlNode node)
            {
                string str = node.InnerText;
                if (node.HasChildNodes)
                {
                    str = "";
                    foreach (System.Xml.XmlNode n in node.ChildNodes)
                    {
                        str += Get(n);
                    }
                }
                return str;
            }