SelectSingleNode函数不返回XML文档

时间:2015-06-29 14:33:58

标签: asp.net xml vb.net

我是XML的新手。但是有人被要求将第三方工具quizmaker合并到我们的应用程序中,其中应用程序的结果如下所示。

<?xml version="1.0" encoding="UTF-8"?>
<quizReport xmlns="http://www.ispringsolutions.com/ispring/quizbuilder/quizresults" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ispringsolutions.com/ispring/quizbuilder/quizresults quizReport.xsd" version="1">
    <quizSettings quizType="graded" maxScore="80" maxNormalizedScore="100" timeLimit="0">
        <passingPercent>0.75</passingPercent>
    </quizSettings>
    <summary score="30" percent="0.375" time="69">
        <variables />
    </summary>
    <questions>
        <multipleChoiceQuestion id="{EB2FBA26-B728-45B1-A360-5C66CBF217A6}" status="incorrect" maxPoints="10" maxAttempts="1" awardedPoints="0" usedAttempts="1">
            <direction>When meeting the executive do you</direction>
            <answers correctAnswerIndex="2" userAnswerIndex="3">
                <answer>Give him a firm handshake</answer>
                <answer>Give him a firm handshake and a bow</answer>
                <answer>Give him a soft handshake and a bow</answer>
                <answer>Bow only</answer>
            </answers>
        </multipleChoiceQuestion>
        <multipleChoiceQuestion id="{BB9874C0-FC02-4A26-B7DA-72471D8EC55E}" status="incorrect" maxPoints="10" maxAttempts="1" awardedPoints="0" usedAttempts="1">
            <direction>He hands you his business card do you</direction>
            <answers correctAnswerIndex="2" userAnswerIndex="1">
                <answer>Take the card with your left hand and immediately put it in your pocket</answer>
                <answer>Take the card with your right hand and put it on the table</answer>
                <answer>Take the card with both hands and study it intently</answer>
            </answers>
        </multipleChoiceQuestion>
        <multipleChoiceQuestion id="{4CDAA21F-34A9-4C0A-946E-87BCFCDE6A80}" status="correct" maxPoints="10" maxAttempts="1" awardedPoints="10" usedAttempts="1">
            <direction>During your initial conversation the Company Y executive says something very important that you want to remember. Is it acceptable to write the information on his business card?</direction>
            <answers correctAnswerIndex="1" userAnswerIndex="1">
                <answer>Yes</answer>
                <answer>No</answer>
            </answers>
        </multipleChoiceQuestion>
        <multipleChoiceQuestion id="{5ACF826A-755B-4608-96B3-962678AD2036}" status="incorrect" maxPoints="10" maxAttempts="1" awardedPoints="0" usedAttempts="1">
            <direction>The Company Y executive hands you a contract that he wants you to sign before your discussions begin do you</direction>
            <answers correctAnswerIndex="2" userAnswerIndex="0">
                <answer>Tell him that the contract will come at the end after they have reached a mutual decision</answer>
                <answer>Sign the contract, it can always be changed later</answer>
                <answer>Tell him that you will need to have it reviewed by your manager for approval</answer>
            </answers>
        </multipleChoiceQuestion>
        <multipleChoiceQuestion id="{6C2EBA2E-9D54-4435-9C93-2A6FC7B18C7B}" status="incorrect" maxPoints="10" maxAttempts="1" awardedPoints="0" usedAttempts="1">
            <direction>During the meeting you discover you did not turn off your cell phone and it rings. It is from another customer who is also very important, do you</direction>
            <answers correctAnswerIndex="1" userAnswerIndex="0">
                <answer>Say "excuse me one moment" and answer the call</answer>
                <answer>Let the call go to voice mail and turn off your ringer</answer>
            </answers>
        </multipleChoiceQuestion>
        <multipleChoiceQuestion id="{A4496C25-BD0A-42FB-8250-8BC398908FCC}" status="correct" maxPoints="10" maxAttempts="1" awardedPoints="10" usedAttempts="1">
            <direction>After the first day of discussions the company Y executive invites you for a drink do you</direction>
            <answers correctAnswerIndex="0" userAnswerIndex="0">
                <answer>Politely accept</answer>
                <answer>Politely decline</answer>
            </answers>
        </multipleChoiceQuestion>
        <multipleChoiceQuestion id="{112B78AB-9051-48DC-B2F7-80564F04A21D}" status="correct" maxPoints="10" maxAttempts="1" awardedPoints="10" usedAttempts="1">
            <direction>The next morning you realize that you have a conference call scheduled with another customer that could potentially make you 10 minutes late for your meeting with the Company Y executive do you</direction>
            <answers correctAnswerIndex="1" userAnswerIndex="1">
                <answer>Keep the conference call and explain the circumstances to the Company Y executive</answer>
                <answer>Reschedule the conference call so that you are on time for the meeting with company Y</answer>
            </answers>
        </multipleChoiceQuestion>
        <multipleChoiceQuestion id="{E9ACCE66-828A-416F-AF1F-BE6672F09F81}" status="incorrect" maxPoints="10" maxAttempts="1" awardedPoints="0" usedAttempts="1">
            <direction>You have reached a final agreement and it is time to sign which choice is UNACCEPTABLE?</direction>
            <answers correctAnswerIndex="1" userAnswerIndex="0">
                <answer>Giving the Company Y executive a gift in appreciation</answer>
                <answer>Signing the contract with your favorite red pen</answer>
                <answer>Giving the executive a soft pat on the back</answer>
            </answers>
        </multipleChoiceQuestion>
    </questions>
</quizReport>

我想要完成的是非常简单的,即将此XML中的Questions节点下的所有问题存储到我们的数据库中

 Dim myXML As String = dt(0)("dr")
    Dim doc As New XmlDocument
    doc.LoadXml(myXML)

    Dim nodes As XmlNode
    nodes = doc.SelectSingleNode("/quizReport/questions")
    Dim dc As New Dictionary(Of String, String)
    Dim j As Integer = 0
    For Each snode As XmlNode In nodes.ChildNodes
        dc.Add(snode.Attributes("id").Value, snode.SelectSingleNode("direction").InnerText)
        j += 1
    Next

但我始终将节点变量视为 NOTHING ,或者选择单个节点不返回任何内容。很想知道我做错了什么

0 个答案:

没有答案