<Sections>
<Classes>
<Class>VI</Class>
<Class>VII</Class>
</Classes>
<Students>
<Student>abc</Student>
<Student>def</Student>
</Students>
</Sections>
Run Code Online (Sandbox Code Playgroud)
我必须遍历Classes才能将'Class'变成一个字符串数组.我还必须循环"学生",让'学生'进入一系列字符串.
XDocument doc.Load("File.xml");
string str1;
foreach(XElement mainLoop in doc.Descendants("Sections"))
{
foreach(XElement classLoop in mainLoop.Descendants("Classes"))
str1 = classLoop.Element("Class").Value +",";
//Also get Student value
}
Run Code Online (Sandbox Code Playgroud)
没有努力获得所有课程.另外,我需要在不使用LINQ to XML的情况下重写它,即使用XmlNodeList和XmlNodes.
XmlDocument doc1 = new XmlDocument();
doc1.Load("File.xml");
foreach(XmlNode mainLoop in doc.SelectNodes("Sections")) ??
Run Code Online (Sandbox Code Playgroud)
不确定如何去做.
在过去的几周里,我一直在闲暇时间使用Apache Mahout机器学习库.我很想知道其他人如何使用这些库.