Talk:XML/Output: Difference between revisions

Content added Content deleted
(→‎Modification of Task: try to make the task clearer)
Line 16: Line 16:
==Modification of Task==
==Modification of Task==
I suggest the task be changed to adress some of the issues discussed above. I would suggest the following
I suggest the task be changed to adress some of the issues discussed above. I would suggest the following



----
----
Create a function that takes a list of character names and a list of corresponding remarks and returns an XML doccument of <code><Character></code> elements each with a name attributes and surrounding their remarks. All <code><Character></code> elements are to be enclosed in an outer <code><CharacterQuotes></code> 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: “<code>April</code>”, “<code>Tam O'Shanter</code>”, and “<code>Emily</code>” and remarks 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:
Line 27: Line 25:
and “Short & shrift”</pre>
and “Short & shrift”</pre>
Should produce the XML (modulo line breaks):
Should produce the XML (modulo line breaks):
<pre><Characters>
<pre><CharacterQuotes>
<Character name="April">Bubbly: I'm &amp;gt; Tam and &amp;lt;= Emily</Character>
<Character name="April">Bubbly: I'm &amp;gt; Tam and &amp;lt;= Emily</Character>
<Character name="Tam O&amp;apos;Shanter"
<Character name="Tam O&amp;apos;Shanter"
>Burns: &amp;quot;When chapman billies leave the street ...&amp;quot;</Character>
>Burns: &amp;quot;When chapman billies leave the street ...&amp;quot;</Character>
<Character name="Emily">Short &amp;amp; shrift</Character>
<Character name="Emily">Short &amp;amp; shrift</Character>
</Characters></pre>
</CharacterQuotes></pre>


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
Line 40: Line 38:
:The suggested task description is not quite clear to a non-English speaking person like me. Maybe splitting it into shorter sentences would help. Anyway, I think I got the idea from the examples. But I think the example input should not contain language specific details such as the \ escape character. And not the quotes (string delimiters) either, if they are not supposed to be part of the input text. --[[User:PauliKL|PauliKL]] 09:42, 9 June 2009 (UTC)
:The suggested task description is not quite clear to a non-English speaking person like me. Maybe splitting it into shorter sentences would help. Anyway, I think I got the idea from the examples. But I think the example input should not contain language specific details such as the \ escape character. And not the quotes (string delimiters) either, if they are not supposed to be part of the input text. --[[User:PauliKL|PauliKL]] 09:42, 9 June 2009 (UTC)


Hi Paul, I'll work on the description, but on the use of \: I couldn't think of a way to include a quote in a quoted string without it - I am open to sugestions though. --[[User:Paddy3118|Paddy3118]] 11:11, 9 June 2009 (UTC)
::Hi Paul, I'll work on the description, but on the use of \: I couldn't think of a way to include a quote in a quoted string without it - I am open to sugestions though. --[[User:Paddy3118|Paddy3118]] 11:11, 9 June 2009 (UTC)
:::That's the point when I use UNICODE quotes. Thankfully they're easy to type on this keyboard. —[[User:Dkf|Donal Fellows]] 12:26, 9 June 2009 (UTC)