XML/Output: Difference between revisions
Content added Content deleted
(→{{header|PicoLisp}}: Fix typo in lib-import line) |
m ({{out}}) |
||
Line 1: | Line 1: | ||
{{task|XML}} |
{{task|XML}} |
||
Create a function that takes a list of character names and a list of corresponding remarks and returns an XML document of <code><Character></code> elements each with a name attributes and each enclosing its remarks |
Create a function that takes a list of character names and a list of corresponding remarks and returns an XML document of <code><Character></code> elements each with a name attributes and each enclosing its remarks. |
||
All <code><Character></code> elements are to be enclosed in turn, in an outer <code><CharacterRemarks></code> element. |
|||
As an example, calling the function with the three names of: |
As an example, calling the function with the three names of: |
||
Line 24: | Line 25: | ||
Note too that although the task is written to take two lists of corresponding data, a single mapping/hash/dictionary of names to remarks is also acceptable. |
Note too that although the task is written to take two lists of corresponding data, a single mapping/hash/dictionary of names to remarks is also acceptable. |
||
'''Note to editors:''' Program output with escaped characters will be viewed as the character on the page so you need to 'escape-the-escapes' to make the RC entry display what would be shown in a plain text viewer (See [[Talk:XML_Creation#Escaping_Escapes|this]]). |
'''Note to editors:''' Program output with escaped characters will be viewed as the character on the page so you need to 'escape-the-escapes' to make the RC entry display what would be shown in a plain text viewer (See [[Talk:XML_Creation#Escaping_Escapes|this]]). |
||
Alternately, output can be placed in <nowiki><lang xml></lang></nowiki> tags without any special treatment. |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |
||
{{works with|GNAT}} |
{{works with|GNAT}} |
||
Line 368: | Line 371: | ||
) |
) |
||
)</lang> |
)</lang> |
||
{{out}} |
|||
Output: |
|||
< |
<pre><?xml?> |
||
<CharacterRemarks><Character name="April">Bubbly: I'm > Tam and <= Emily</Character> |
<CharacterRemarks><Character name="April">Bubbly: I'm > Tam and <= Emily</Character> |
||
<Character name="Tam O'Shanter">Burns: "When chapman billies leave the street ..."</Character> |
<Character name="Tam O'Shanter">Burns: "When chapman billies leave the street ..."</Character> |
||
<Character name="Emily">Short & shrift</Character> |
<Character name="Emily">Short & shrift</Character> |
||
</CharacterRemarks></ |
</CharacterRemarks></pre> |
||
=={{header|C}}== |
=={{header|C}}== |
||
Line 530: | Line 533: | ||
"Short & shrift"))</lang> |
"Short & shrift"))</lang> |
||
{{out}} |
|||
output: |
|||
<div style="width:full;overflow:scroll"> |
<div style="width:full;overflow:scroll"> |
||
<pre><?xml version="1.0" encoding="UTF-8"?> |
<pre><?xml version="1.0" encoding="UTF-8"?> |
||
Line 708: | Line 711: | ||
puts(1,"</CharacterRemarks>\n")</lang> |
puts(1,"</CharacterRemarks>\n")</lang> |
||
{{out}} |
|||
Output: |
|||
< |
<pre><CharacterRemarks> |
||
<CharacterName="April">Bubbly: I'm > Tam and <= Emily</Character> |
<CharacterName="April">Bubbly: I'm > Tam and <= Emily</Character> |
||
<CharacterName="Tam O'Shanter">Burns: "When chapman billies leave the street ..."</Character> |
<CharacterName="Tam O'Shanter">Burns: "When chapman billies leave the street ..."</Character> |
||
<CharacterName="Emily">Short & shrift</Character> |
<CharacterName="Emily">Short & shrift</Character> |
||
</CharacterRemarks> |
</CharacterRemarks> |
||
</ |
</pre> |
||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |
||
Line 788: | Line 791: | ||
</lang> |
</lang> |
||
{{out}} (not exactly conforming): |
|||
<pre> |
<pre> |
||
<?xml version='1.0' encoding='UTF-8'?> |
<?xml version='1.0' encoding='UTF-8'?> |