0

我需要解析的 xml 文件在节点内有 HTML 标记,但不存在用于 HTML 内容的 CDATA 部分。有没有一种方法可以使用 java xml 解析器解析提供文本和 html 标签的 xml 文件。而且我不应该编辑 xml 文件。

以下是我尝试使用 java xml 解析器解析的 XML 文件:

<assessmentItem xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p0 imsqti_v2p0.xsd" identifier="choice" adaptive="false" timeDependent="false" title="200007" xmlns="http://www.imsglobal.org/xsd/imsqti_v2p0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <responseDeclaration identifier="RESPONSE" cardinality="single" baseType="identifier">
        <correctResponse>
             <value>C</value>
        </correctResponse>
    </responseDeclaration>
    <outcomeDeclaration identifier="SCORE" cardinality="single" baseType="integer"
        <defaultValue>
            <value>0</value>
        </defaultValue>
    </outcomeDeclaration>
    <stylesheet href="stylesheet/scip.css" type="text/css" />
    <itemBody>
        <span class="class1">
            <b>The graph shows how many children named different animals as favorite pets.<br /><br /></b>
        </span>
        <div class="class2">
            <span class="class1">
                <b><img src="images/15063.jpg" alt="" /></b>
            </span>
        </div>
        <span class="class1">
            <b>How many children liked dogs or cats as their favorite pets?</b>
        </span>
        <choiceInteraction responseIdentifier="RESPONSE" shuffle="false" maxChoices="1">
            <simpleChoice identifier="A">
                <span class="class1">30</span>
                <rubricBlock>
                    <span class="class1" >Chose the number of cats</span>
                </rubricBlock>
            </simpleChoice>
            <simpleChoice identifier="B">
                <span class="class1">40</span>
                <rubricBlock>
                    <span class="class1" >Chose the number of dogs</span>
                </rubricBlock>
            </simpleChoice>
            <simpleChoice identifier="C">
                <span class="class1">70</span>
                <rubricBlock>
                    <span class="class1" ><b>Correct</b></span>
                </rubricBlock>
            </simpleChoice>
            <simpleChoice identifier="D">
                <span class="class1">150</span>
                <rubricBlock>
                    <span class="class1" >Chose the sum of all the pets in the table</span>
                </rubricBlock>
            </simpleChoice>
        </choiceInteraction>
    </itemBody>
    <responseProcessing template="http://www.imsglobal.org/question/qti_v2p0/rptemplates/match_correct" />
</assessmentItem>
4

0 回答 0