Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
46
Task/XML-Output/ALGOL-68/xml-output-1.alg
Normal file
46
Task/XML-Output/ALGOL-68/xml-output-1.alg
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# returns a translation of str suitable for attribute values and content in an XML document #
|
||||
OP TOXMLSTRING = ( STRING str )STRING:
|
||||
BEGIN
|
||||
STRING result := "";
|
||||
FOR pos FROM LWB str TO UPB str DO
|
||||
CHAR c = str[ pos ];
|
||||
result +:= IF c = "<" THEN "<"
|
||||
ELIF c = ">" THEN ">"
|
||||
ELIF c = "&" THEN "&"
|
||||
ELIF c = "'" THEN "'"
|
||||
ELIF c = """" THEN """
|
||||
ELSE c
|
||||
FI
|
||||
OD;
|
||||
result
|
||||
END; # TOXMLSTRING #
|
||||
|
||||
# generate a CharacterRemarks XML document from the characters and remarks #
|
||||
# the number of elements in characters and remrks must be equal - this is not checked #
|
||||
# the <?xml?> element is not generated #
|
||||
PROC generate character remarks document = ( []STRING characters, remarks )STRING:
|
||||
BEGIN
|
||||
STRING result := "<CharacterRemarks>";
|
||||
INT remark pos := LWB remarks;
|
||||
FOR char pos FROM LWB characters TO UPB characters DO
|
||||
result +:= "<Character name=""" + TOXMLSTRING characters[ char pos ] + """>"
|
||||
+ TOXMLSTRING remarks[ remark pos ]
|
||||
+ "</Character>"
|
||||
+ REPR 10
|
||||
;
|
||||
remark pos +:= 1
|
||||
OD;
|
||||
result +:= "</CharacterRemarks>";
|
||||
result
|
||||
END; # generate character remarks document #
|
||||
|
||||
# test the generation #
|
||||
print( ( generate character remarks document( ( "April", "Tam O'Shanter", "Emily" )
|
||||
, ( "Bubbly: I'm > Tam and <= Emily"
|
||||
, "Burns: ""When chapman billies leave the street ..."
|
||||
, "Short & shrift"
|
||||
)
|
||||
)
|
||||
, newline
|
||||
)
|
||||
)
|
||||
4
Task/XML-Output/ALGOL-68/xml-output-2.alg
Normal file
4
Task/XML-Output/ALGOL-68/xml-output-2.alg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue