Talk:XML/Output: Difference between revisions

Content added Content deleted
(→‎Modification of Task: try to make the task clearer)
Line 22: Line 22:
Create a function that takes a list of character names and a list of corresponding remarks and returns an XML doccument of <Character> elements each with a name attributes and surrounding their remarks. All <Character> elements are to be enclosed in an outer <Characcters> element.
Create a function that takes a list of character names and a list of corresponding remarks and returns an XML doccument of <Character> elements each with a name attributes and surrounding their remarks. All <Character> elements are to be enclosed in an outer <Characcters> element.


As an example, calling the function with names of:
As an example, calling the function with names of: “<code>April</code>”, “<code>Tam O'Shanter</code>”, and “<code>Emily</code>” and remarks of:
<pre>“Bubbly: I\'m > Tam and <= Emily”
"April", "Tam O'Shanter", and "Emily".
“Burns: "When chapman billies leave the street ..."
And remarks of:
and “Short & shrift”</pre>
'Bubbly: I\'m > Tam and <= Emily'
Should produce the XML (modulo line breaks):
'Burns: "When chapman billies leave the street ..."'
<pre><Characters>
and 'Short & shrift'
<Character name="April">Bubbly: I'm &amp;gt; Tam and &amp;lt;= Emily</Character>

<Character name="Tam O&amp;apos;Shanter"
Should produce the XML:
>Burns: &amp;quot;When chapman billies leave the street ...&amp;quot;</Character>
<Characters>
<Character name="April">Bubbly: I'm &gt; Tam and &lt;= Emily</Character>
<Character name="Emily">Short &amp;amp; shrift</Character>
</Characters></pre>
<Character name="Tam O&apos;Shanter">Burns: "When chapman billies leave the street ..."</Character>
<Character name="Emily">Short &amp; shrift</Character>
</Characters>



Note: the example is chosen to also show correct escaping of XML strings
Note: the example is chosen to also show correct escaping of XML strings