我以前从未使用过 XML。我正在尝试将单个 XML 文件发送到 SQL Server,在那里它(希望)能够被解构并插入到各种表中。
我正在构建测试。因此,每个测试有 X 个问题,每个问题有 X 个答案选项和 1 个正确答案的解释。以下 XML 示例是否有效?我错过了任何可以简化它的东西吗?
<test>
<testid>1</testid>
<qablock>
<question>
<question_number>1</question_number>
<question_text>What is 1 + 1?</question_text>
</question>
<explanation>It's 2.</explanation>
<options>
<option>
<option_number>1</option_number>
<option_value>1</option_value>
<is_correct>0</is_correct>
</option>
<option>
<option_number>2</option_number>
<option_value>2</option_value>
<is_correct>1</is_correct>
</option>
<option>
<option_number>3</option_number>
<option_value>3</option_value>
<is_correct>0</is_correct>
</option>
<option>
<option_number>4</option_number>
<option_value>4</option_value>
<is_correct>0</is_correct>
</option>
<option>
<option_number>5</option_number>
<option_value>5</option_value>
<is_correct>0</is_correct>
</option>
</options>
</qablock>
<qablock>
<question>
<question_number>2</question_number>
<question_text>What is 2 + 2?</question_text>
</question>
<explanation>It's 4.</explanation>
<options>
<option>
<option_number>1</option_number>
<option_value>1</option_value>
<is_correct>0</is_correct>
</option>
<option>
<option_number>2</option_number>
<option_value>2</option_value>
<is_correct>0</is_correct>
</option>
<option>
<option_number>3</option_number>
<option_value>3</option_value>
<is_correct>0</is_correct>
</option>
<option>
<option_number>4</option_number>
<option_value>4</option_value>
<is_correct>1</is_correct>
</option>
<option>
<option_number>5</option_number>
<option_value>5</option_value>
<is_correct>0</is_correct>
</option>
</options>
</qablock>
</test>