Skip to content
Newer
Older
100644 37 lines (37 sloc) 7.11 KB
63b340a @mdp getting tired of always having to have an internet connection for ama…
mdp authored Oct 27, 2009
1 <html xmlns:fo="http://www.w3.org/1999/XSL/Format"><head>
2 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3 <title>Using XML Parameter Values</title><link rel="stylesheet" href="aws-docs-IE.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="#top" title="Amazon Mechanical Turk"><link rel="up" href="ApiReference_QuestionAnswerDataArticle.html" title="Chapter&nbsp;7.&nbsp;Question and Answer Data"><link rel="prev" href="ApiReference_QuestionAnswerDataArticle.html" title="Chapter&nbsp;7.&nbsp;Question and Answer Data"><link rel="next" href="ApiReference_QuestionFormDataStructureArticle.html" title="QuestionForm"><!--[if !IE]>--><link rel="stylesheet" href="aws-docs.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><!--<![endif]--><meta xmlns="http://www.w3.org/1999/xhtml" http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><script src="/urchin.js" type="text/javascript"></script><script type="text/javascript">
4 urchinTracker();
5 </script><script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript" src="frameset.js"> //
6 </script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header" cellspacing="0" cellpadding="2"><tr><td width="30%" align="left"><a accesskey="p" href="ApiReference_QuestionAnswerDataArticle.html"><img src="images/prev.gif" alt="Prev"></a> </td><td width="40%" align="center"><a href="http://survey.amazonwebservices.com/survey/s?s=559&amp;opdata_page=Mturk_API_2008-08-02_ApiReference_XMLParameterValuesArticle">Documentation Feedback</a></td><td width="30%" align="right"> <a accesskey="n" href="ApiReference_QuestionFormDataStructureArticle.html"><img src="images/next.gif" alt="Next"></a></td></tr></table><div class="breadcrumb"><a href="Welcome.html">Welcome</a><a href=""></a> &raquo; <a href="ApiReference_QuestionAnswerDataArticle.html">Question and Answer Data</a> &raquo; <strong>Using XML Parameter Values</strong></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h1 class="topictitle">Using XML Parameter Values</h1></div></div></div><a class="indexterm" name="d0e16918"></a><a class="indexterm" name="d0e16921"></a><p> The <a class="link" href="ApiReference_QuestionFormDataStructureArticle.html" title="QuestionForm">QuestionForm</a>, <a class="link" href="ApiReference_QuestionFormAnswersDataStructureArticle.html" title="QuestionFormAnswers">QuestionFormAnswers</a>, and
7 <a class="link" href="ApiReference_AnswerKeyDataStructureArticle.html" title="AnswerKey">AnswerKey</a> data structures are
8 used as parameter values in service requests, and as return values in service responses. Unlike other
9 data structures described in this API reference, these XML structures are not part of the service API
10 directly, but rather are used as string values going in and out of the service. This article describes
11 the encoding methods needed to use XML data as parameter and return values. </p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both" id="d0e16935">XML Data as a Parameter</h2></div></div></div><p> For SOAP requests, XML data in a parameter value must appear in the request <span class="emphasis"><em>XML
12 escaped</em></span>. Characters that are part of XML syntax, such as ampersands
13 (<strong class="userinput"><code>&amp;</code></strong>) and angle brackets
14 (<strong class="userinput"><code>&lt;&gt;</code></strong>), must be replaced with the corresponding XML character
15 entities in the parameter value. Most SOAP toolkits will automatically escape data set as the
16 string value of the parameter. </p><p> The following is a fragment of a <em class="parameter"><code>QuestionForm</code></em> data structure, escaped
17 with XML character entities: </p><pre class="programlisting">&amp;lt;QuestionForm xmlns="..."&amp;gt;
18 &amp;lt;Overview&amp;gt;
19 &amp;lt;Text&amp;gt;
20 Musicals by Rodgers &amp;amp;amp; Hart...
21 &amp;lt;/Text&amp;gt;
22 &amp;lt;Overview&amp;gt;
23 ...
24 &amp;lt;/QuestionForm&amp;gt;</pre><p> For REST requests, the data must be <span class="emphasis"><em>URL encoded</em></span> to appear as a single
25 parameter value in the request. (This is true for all REST parameter values.) Characters that are
26 part of URL syntax, such as question marks (<strong class="userinput"><code>?</code></strong>) and ampersands
27 (<strong class="userinput"><code>&amp;</code></strong>), must be replaced with the corresponding URL character
28 codes. </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p> XML data in REST requests should only be URL encoded, <span class="emphasis"><em>not</em></span> XML escaped.
29 </p></td></tr></table></div><p> In service responses, this data will be XML escaped. </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both" id="d0e16975">Namespaces for XML Parameter Values</h2></div></div></div><p> XML data in parameter values must have a namespace specified for all elements. The easiest way
30 to do this is to include an <code class="code">xmlns</code> attribute in the root element equal to the
31 appropriate namespace. </p><p> The namespace for a <em class="parameter"><code>QuestionForm</code></em>,
32 <em class="parameter"><code>QuestionFormAnswers</code></em>, or <em class="parameter"><code>AnswerKey</code></em> element is
33 identical to the URL of the corresponding schema document, including the version date. While XML
34 namespaces need not be URLs according to the XML specification, this convention ensures that the
35 consumer of the value knows which version of the schema is being used for the data. </p><p> For the locations of the schema documents, as well as instructions on how to include the
36 version date in the URL, see <a class="link" href="ApiReference_WsdlLocationArticle.html" title="Chapter&nbsp;3.&nbsp;WSDL and Schema Locations">WSDL and Schema
37 Locations</a>. </p></div></div><div class="navfooter"><table width="100%" summary="Navigation footer" cellspacing="0" cellpadding="2"><tr><td width="30%" align="left"><a accesskey="p" href="ApiReference_QuestionAnswerDataArticle.html"><img src="images/prev.gif" alt="Prev"></a> </td><td width="40%" align="center"><a href="http://survey.amazonwebservices.com/survey/s?s=559&amp;opdata_page=Mturk_API_2008-08-02_ApiReference_XMLParameterValuesArticle">Documentation Feedback</a><br><a href="copyrightinfo.html">Copyright Information</a></td><td width="30%" align="right"> <a accesskey="n" href="ApiReference_QuestionFormDataStructureArticle.html"><img src="images/next.gif" alt="Next"></a></td></tr><tr><td width="30%" align="left" valign="top">&nbsp;</td><td width="40%" align="center"><a accesskey="h" href="#top"><img src="images/home.gif" alt="Home"></a></td><td width="30%" align="right" valign="top">&nbsp;</td></tr></table></div></body></html>
Something went wrong with that request. Please try again.