您的位置:首页 > 其它

70-528试题2:仍然是有关xml的

2007-04-12 21:10 246 查看
仍然是有关xml的


You load an XmlDocument named doc with the following XML.
<bookstore>
<books>
<book genre=”reference”>
<title>Dictionary</title>
</book>
<book genre=”reference”>
<title>World Atlas</title>
</book></books>
</bookstore>
You need to change the value for the genre attribute to NA for all book attributes.
First, you add the following code segment to your class.

XmlElement root = doc.DocumentElement;
XmlNodelist nodes = root.SelectNodes(“books/book”);
Which additional two code segments can you use to achieve this goal?(Each correct answer presents a complete solution. Choose two.)
A. foreach(XmlNode node in nodes){node.Attributes[0].Value = “NA”;}
B. foreach(XmlNode node in nodes){node.Attributes[1].Value = “NA”;}
C. foreach(XmlNode node in nodes){XmlNode genre = node.SelectSingleNode(“/genre”); genre.Value = “NA”;}
D.
foreach(XmlNode node in nodes){XmlNode genre = node.SelectSingleNode(“@genre”); genre.Value = “NA”;}
E. foreach(XmlNode node in nodes){XmlNode genre = node.SelectSingleNode(“genre”); genre.Value = “NA”;}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: