Jump to content

XML/Output: Difference between revisions

m
{{out}}
(→‎{{header|PicoLisp}}: Fix typo in lib-import line)
m ({{out}})
Line 1:
{{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. All <code><Character></code> elements are to be enclosed in turn, in an outer <code><CharacterRemarks></code> element.
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:
Line 24 ⟶ 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 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.
Alternately, output can be placed in <nowiki><lang xml></lang></nowiki> tags without any special treatment.
 
=={{header|Ada}}==
{{works with|GNAT}}
Line 368 ⟶ 371:
)
)</lang>
{{out}}
Output:
<lang xmlpre><?xml?>
<CharacterRemarks><Character name="April">Bubbly: I'm &gt; Tam and &lt;= Emily</Character>
<Character name="Tam O'Shanter">Burns: "When chapman billies leave the street ..."</Character>
<Character name="Emily">Short &amp; shrift</Character>
</CharacterRemarks></langpre>
 
=={{header|C}}==
Line 530 ⟶ 533:
"Short & shrift"))</lang>
 
{{out}}
output:
<div style="width:full;overflow:scroll">
<pre><?xml version="1.0" encoding="UTF-8"?>
Line 708 ⟶ 711:
puts(1,"</CharacterRemarks>\n")</lang>
 
{{out}}
Output:
<lang xmlpre><CharacterRemarks>
<CharacterName="April">Bubbly: I&apos;m &gt; Tam and &lt;= Emily</Character>
<CharacterName="Tam O&apos;Shanter">Burns: &quot;When chapman billies leave the street ...&quot;</Character>
<CharacterName="Emily">Short &amp; shrift</Character>
</CharacterRemarks>
</langpre>
 
=={{header|F_Sharp|F#}}==
Line 788 ⟶ 791:
</lang>
 
Output{{out}} (not exactly conforming):
<pre>
<?xml version='1.0' encoding='UTF-8'?>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.