【发布时间】:2010-09-18 07:32:33
【问题描述】:
我正在尝试以问题形式从我的 php Web 应用程序将 html 数据发送到 Mechanical turk,以便用户可以从电子邮件中查看整个 html 文档以进行处理。到目前为止,我遇到了困难。在下面链接的线程中,我尝试使用 html5-lib.php 解析 html 数据,但我认为我仍然缺少一个步骤来完成此操作。
这是我收到的当前错误:
Catchable fatal error: Object of class DOMNodeList could not be converted to string in urlgoeshere.php on line 35
这是我正在使用的当前代码......
$thequestion = '<a href="linkgoeshere" target="_blank">click here</a>';
$thequestion = HTML5_Parser::parseFragment($thequestion);
var_dump($thequestion);
echo $thequestion;
//htmlspecialchars($thequestion);
$QuestionXML = '<QuestionForm xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd">
<Question>
<QuestionContent>
<Text>'.$thequestion.'</Text> //<--- Line35
</QuestionContent>
<AnswerSpecification>
<FreeTextAnswer/>
</AnswerSpecification>
</Question>
</QuestionForm> ';
我不能 100% 确定解析器是否是我需要做的才能正确发送它 - 我要做的就是通过这个 xml 类型的文档发送 html - 我很惊讶它是如此困难远的。
这在某种程度上是另一个线程的延续 - What PHP code will help me parse html data in an xml form?
【问题讨论】:
-
明确地说,它就像没有 html 变量的文本一样完美地工作 - 现在它不能与 html 一起工作引用。我尝试了 cdata,但没有帮助。
-
事实证明这些答案都不正确 - 我需要将文本更改为格式化内容
标签: php xml xml-serialization domdocument mechanicalturk