1.You are creating an XML Web service named CustomerService. This service receives an XML file of customer information in the following format: <CustomerData> <Customers> <CustomerID>1234</CustomerID> <CompanyName>Adventure Works</CompanyName> </Customers> <Customers> <CustomerID>2345</CustomerID> <CompanyName>Coho Winery</CompanyName> </Customers> </CustomerData> You want to parse the XML file to build a flat file that will be used by another application. The flat file should be in the following format: CustomerID=1234 CompanyName=Adventure Works CustomerID=2345 CompanyName=Coho Winery You write the following code: Dim myXMLDoc As New XmlDocument() myXMLDoc.Load("C:\TableSchemaXML.xml") Dim myRootNode As XmlNode = myXMLDoc.FirstChild Dim customerOutput As String Dim curNode As XmlNode Dim i As Integer You need to write the code that will parse the document and build the customerOutput string that will be used to write each row in the file. Which code segment should you use? A: Dim myNodeList As XmlNodeList = _myRootNode.SelectNodes("/CustomerData/Customers")For Each curNode In myNodeListIf curNode.HasChildNodes ThencustomerOutput = ""For i = 0 To curNode.ChildNodes.Count ?1customerOutput = curNode.ChildNodes(i).Name & _"=" + curNode.ChildNodes(i).InnerText' Code to write the output file goes here.Next iEnd IfNextB: Dim myNodeList As XmlNodeList = _myRootNode.SelectNodes("/CustomerData/Customers")For Each curNode In myNodeListIf curNode.HasChildNodes ThencustomerOutput = ""For i = 0 To curNode.ChildNodes.Count ?1customerOutput = curNode.ChildNodes(i).Name & _"=" + curNode.ChildNodes(i).Value' Code to write the output file goes here.Next iEnd IfNextC: Dim myNodeList As XmlNodeList = _myRootNode.SelectNodes("/Customers")For Each curNode In myNodeListIf curNode.HasChildNodes ThencustomerOutput = ""For i = 0 To curNode.ChildNodes.Count ?1customerOutput = curNode.ChildNodes(i).Name & _"=" + curNode.ChildNodes(i).InnerText' Code to write the output file goes here.Next iEnd IfNextD: Dim myNodeList As XmlNodeList = _myRootNode.SelectNodes("/Customers")For Each curNode In myNodeListIf curNode.HasChildNodes ThencustomerOutput = ""For i = 0 To curNode.ChildNodes.Count ?1customerOutput = _curNode.ChildNodes(i).Attributes(0).value + "=" &_curNode.ChildNodes(i).Attributes(1).Value' Code to write the output file goes here.Next iEnd IfNextCorrect Answers: A 2.You are creating an XML Web service named WeatherService that provides the current weather conditions for cities around the world. Your development cycle includes three stages: development, testing, and production. In each stage, WeatherService will be deployed on a different server. For testing, you create an ASP.NET application named WeatherTest. To WeatherTest, you add a Web reference to WeatherService. You then build a user interface and add the necessary code to test the service. The WeatherService interface will not change between testing and deployment. You want to ensure that you do not have to recompile WeatherTest every time WeatherService is moved from one server to another. What should you do? A: Each time WeatherService is moved, set the URL property of the generated proxy class to the new location.B: Each time WeatherService is moved, set the Web Reference URL property of the generated proxy class to the new location.C: Set the URLBehavior property of the generated proxy class to dynamic. Each time WeatherService is moved, update the appropriate key inthe Web.config file to indicate the new location.D: Take the location of WeatherService as input to WeatherTest, and set the Proxy property of all proxy class instances to that location.Correct Answers: C 3.You are troubleshooting a Visual Studio .NET application that was developed by a former colleague. You find the following code segment within a large assembly: Dim theElement As XmlElement Dim anotherElement As XmlElement Dim doc As New XmlDocument() Dim theDecl As XmlDeclaration theDecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing) doc.AppendChild(theDecl) theElement = doc.CreateElement("Library") doc.AppendChild(theElement) theElement = doc.CreateElement("Book") theElement.SetAttribute("type", "Mystery") anotherElement = doc.CreateElement("Title") anotherElement.InnerText = "Book Title" anotherElement.AppendChild(theElement) doc.DocumentElement.AppendChild(theElement) Which XML output is produced by this code segment? A: <?xml version="1.0"?><Library />B: <?xml version="1.0"?><Library><Book type="Mystery" /></Library>C: <?xml version="1.0"?><Library><Book type="Mystery"><Title>Book Title</Title></Book></Library>D: <?xml version="1.0"?><Library><Title>Book Title<Book type="Mystery" /></Title>
本新闻共3页,当前在第1页 1 2 3