Talk:XML/Output: Difference between revisions

→‎Modification of Task: try to make the task clearer
(→‎Modification of Task: try to make the task clearer)
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.
 
As an example, calling the function with names of: “<code>April</code>”, “<code>Tam O'Shanter</code>”, and “<code>Emily</code>” and remarks of:
'Bubbly<pre>“Bubbly: I\'m > Tam and <= Emily'Emily”
"April", "Tam O'Shanter", and "Emily".
'Burns“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="EmilyApril">ShortBubbly: I'm &amp;gt; shriftTam and &amp;lt;= Emily</Character>
 
<Character name="Tam O&amp;apos;Shanter"
Should produce the XML:
<Character name="Tam O&apos;Shanter" >Burns: "&amp;quot;When chapman billies leave the street ..."&amp;quot;</Character>
<Characters>
<Character name="AprilEmily">Bubbly: I'mShort &gtamp; Tam and &ltamp;= Emilyshrift</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
Anonymous user