我正在关注一个使用库MTurkR为MTurk调查添加限定符的示例: https://github.com/leeper/MTurkR/wiki/Qualification-Tests-for-Worker-Pre-Screening
读取xml外部文件(例如):
QuestionForm <- paste0(readLines('Test.xml'), collapse='')
生成警告消息:
In readLines("Test.xml") : incomplete final line found on 'Test.xml'
问题表单的内容有点难以粘贴(文件在下面),但最后一行是示例结束。
当我尝试使用此命令构建资格时,警告显得很重要:
newqual <- CreateQualificationType(name="Qualification",
description="A qualification for our HITs",
status="Active", test.duration=seconds(hours=1),
test=QuestionForm, answerkey = AnswerKey)
会产生这些错误:
AttValue:&#34;或者&#39;期望属性构造错误无法找到结束 开始标记QuestionForm第1行结尾处的额外内容 文件错误:1:AttValue:&#34;或者&#39;预期2:属性构造 错误3:无法找到开始标记问题结果第1行4:额外 文件末尾的内容
下面粘贴了Test.xml。我尝试在其他地方的每个在线建议添加一个空白的结束行,然后确保没有空格或空行。我得到了AnswerKey.xml的相同错误。在网站上生成的LayoutID适用于问卷创建/数据转储/管理,但这是关键点。
的test.xml:
<QuestionForm xmlns=<"http://mechanicalturk.amazonaws.com/AWSMechanicalTurk
DataSchemas/2005-10-01/QuestionForm.xsd">
<Overview>
<Title>Qualify for the job HIT</Title>
<Text>
Please answer one question to see if you qualify (automatically scored)
</Text>
</Overview>
<Question>
<QuestionIdentifier>employ</QuestionIdentifier>
<IsRequired>true</IsRequired>
<QuestionContent>
<Text>Which best describes your current work?</Text>
</QuestionContent>
<AnswerSpecification>
<SelectionAnswer>
<StyleSuggestion>radiobutton</StyleSuggestion>
<Selections>
<Selection>
<SelectionIdentifier>1</SelectionIdentifier>
<Text>Employed (full- or part-time) for pay and not looking for work</Text>
</Selection>
<Selection>
<SelectionIdentifier>2</SelectionIdentifier>
<Text>Not employed for pay and NOT looking for work (e.g., stay-at-home parent)</Text>
</Selection>
<Selection>
<SelectionIdentifier>3</SelectionIdentifier>
<Text>Looking for work (whether employed, part-time employed, or unemployed)</Text>
</Selection>
</Selections>
</SelectionAnswer>
</AnswerSpecification>
</Question>
</QuestionForm>