XML/Output: Difference between revisions
Added XPL0
m (→{{header|REXX}}: changed DO index. -- ~~~~) |
(Added XPL0) |
||
Line 1,868:
<Character name="Tam O'Shanter">Burns: "When chapman billies leave the street..."</Character>
<Character name="Emily">Short &amp; shrift</Character>
</CharacterRemarks>
</pre>
=={{header|XPL0}}==
<lang XPL0>code ChOut=8, CrLf=9, Text=12;
string 0; \use zero-terminated strings
proc XmlOut(S); \Output string in XML format
char S;
repeat case S(0) of \character entity substitutions
^<: Text(0, "<");
^>: Text(0, ">");
^&: Text(0, "&");
^": Text(0, """);
^': Text(0, "'")
other ChOut(0, S(0));
S:= S+1;
until S(0) = 0;
int Name, Remark, I;
[Name:= ["April", "Tam O'Shanter", "Emily"];
Remark:= ["Bubbly: I'm > Tam and <= Emily",
"Burns: ^"When chapman billies leave the street ...^"",
"Short & shrift"];
Text(0, "<CharacterRemarks>"); CrLf(0);
for I:= 0 to 3-1 do
[Text(0, " <Character name=^"");
XmlOut(Name(I));
Text(0, "^">");
XmlOut(Remark(I));
Text(0, "</Character>"); CrLf(0);
];
Text(0, "</CharacterRemarks>"); CrLf(0);
]</lang>
{{out}}
<pre>
<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="Emily">Short & shrift</Character>
</CharacterRemarks>
</pre>
|