What code segment should you use to use an XmlDocument instance named doc to change the number?

You are developing a Web application that will be integrated into the Domain.com e-Commerce Web site. You used the Load method of the XmlDocument class to load data from an XML document. The XML document is shown in the following exhibit.

You later realize that the required exams should be five and not four. You want to use an XmlDocument instance named doc to change the number of required exams to five.
exhibit What code segment should you use?

You are developing a Web application that will be integrated into the Domain.com e-Commerce Web site. You used the Load method of the XmlDocument class to load data from an XML document. The XML document is shown in the following exhibit.

You later realize that the required exams should be five and not four. You want to use an XmlDocument instance named doc to change the number of required exams to five.
What code segment should you use?

A.
XmlNode aNode = doc.DocumentElement.FirstChild.FirstChild; aNode.ChildNodes[2].InnerText = “5”;

B.
XmlNode aNode = doc.FirstChild.FirstChild;
aNode.ChildNodes[2].Value = “5”;

C.
XmlNode aNode = doc. FirstChild.FirstChild;
aNode.ChildNodes[2].InnerText = “5”;

D.
XmlNode aNode = doc.DocumentElement.FirstChild.FirstChild; aNode.ChildNodes[2].Value = “5”;

Explanation:
This code first accesses the document element, which is Vendor. It then accesses the first child of the Vendor element, which is Certification. It then accesses the first child of the Certification element, which is Exams. It then accesses the third child of the Exams element, which is Required – the first element is index It then sets the inner text of the Required element to 5.



Leave a Reply 0

Your email address will not be published. Required fields are marked *