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”;}
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”;}
相关文章推荐
- 有关编程之美的试题python实现
- 一个有关xml的增删改查
- 有关安全和XML的一些文章
- [转]有关TinyXML使用的简单总结
- XML配置文件导入dtd文件仍然没有自动提示问题的解决
- Struts2学习笔记之与struts.xml配置和Action有关的属性
- javascript下有关dom以及xml节点访问兼容问题
- 有关web.xml配置中的DOCTYPE的问题
- ava7 解析xml文件出现莫名其妙的有关问题
- [转]有关RDF、RSS、XML区别和联系
- 有关RDF、RSS、XML区别和联系
- ALGO-70 VIP试题 最长字符串
- Android有关HTTPS请求传输xml数据
- Unity3d中有关配置表(文件)采用XML和String方法的读取和写入
- Struts2中有关struts-default.xml,struts.xml,struts.properties文件详解
- 使用XML向SQL Server 2005批量写入数据——一次有关XML时间格式的折腾经历
- 有关xml中的xmlns
- maven 遇到failOnMissingWebXml有关问题解决方法
- java面试中有关多线程的试题
- 聊聊这个与代码优化有关的选择题 (某公司实习生招聘笔试试题)