Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
40
Task/XML-Output/BASIC/xml-output-1.basic
Normal file
40
Task/XML-Output/BASIC/xml-output-1.basic
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
Data "April", "Bubbly: I'm > Tam and <= Emily", _
|
||||
"Tam O'Shanter", "Burns: ""When chapman billies leave the street ...""", _
|
||||
"Emily", "Short & shrift"
|
||||
|
||||
Declare Function xmlquote(ByRef s As String) As String
|
||||
Dim n As Integer, dev As String, remark As String
|
||||
|
||||
Print "<CharacterRemarks>"
|
||||
For n = 0 to 2
|
||||
Read dev, remark
|
||||
Print " <Character name="""; xmlquote(dev); """>"; _
|
||||
xmlquote(remark); "</Character>"
|
||||
Next
|
||||
Print "</CharacterRemarks>"
|
||||
|
||||
End
|
||||
|
||||
Function xmlquote(ByRef s As String) As String
|
||||
Dim n As Integer
|
||||
Dim r As String
|
||||
For n = 0 To Len(s)
|
||||
Dim c As String
|
||||
c = Mid(s,n,1)
|
||||
Select Case As Const Asc(c)
|
||||
Case Asc("<")
|
||||
r = r + "<"
|
||||
Case Asc(">")
|
||||
r = r + ">"
|
||||
Case Asc("&")
|
||||
r = r + "&"
|
||||
Case Asc("""")
|
||||
r = r + """
|
||||
Case Asc("'")
|
||||
r = r + "'"
|
||||
Case Else
|
||||
r = r + c
|
||||
End Select
|
||||
Next
|
||||
Function = r
|
||||
End Function
|
||||
29
Task/XML-Output/BASIC/xml-output-2.basic
Normal file
29
Task/XML-Output/BASIC/xml-output-2.basic
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
100 Q$ = CHR$(34)
|
||||
110 DE$(0) = "April"
|
||||
120 RE$(0) = "Bubbly: I'm > Tam and <= Emily"
|
||||
130 DE$(1) = "Tam O'Shanter"
|
||||
140 RE$(1) = "Burns: " + Q$ + "When chapman billies leave the street ..." + Q$
|
||||
150 DE$(2) = "Emily"
|
||||
160 RE$(2) = "Short & shrift"
|
||||
|
||||
200 Print "<CharacterRemarks>"
|
||||
210 For I = 0 to 2
|
||||
220 Print " <Character name="Q$;
|
||||
230 X$=DE$(I) : GOSUB 300xmlquote
|
||||
240 PRINT Q$">";
|
||||
250 X$=RE$(I) : GOSUB 300xmlquote
|
||||
260 PRINT "</Character>"
|
||||
270 Next
|
||||
280 Print "</CharacterRemarks>"
|
||||
290 End
|
||||
|
||||
300 For n = 1 To Len(X$)
|
||||
310 c$ = Mid$(X$,n,1)
|
||||
320 IF C$ = "<" THEN C$ = "<"
|
||||
330 IF C$ = ">" THEN C$ = ">"
|
||||
340 IF C$ = "&" THEN C$ = "&"
|
||||
350 IF C$ = Q$ THEN C$ = """
|
||||
360 IF C$ = "'" THEN C$ = "'"
|
||||
370 PRINT C$;
|
||||
380 NEXT N
|
||||
390 RETURN
|
||||
112
Task/XML-Output/Bracmat/xml-output-1.bracmat
Normal file
112
Task/XML-Output/Bracmat/xml-output-1.bracmat
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
( ( 2XML
|
||||
= PCDATAentities attributeValueEntities doAll doAttributes
|
||||
, xml
|
||||
. ( attributeValueEntities
|
||||
= a c
|
||||
. @( !arg
|
||||
: ?a
|
||||
(("<"|"&"|\"):?c)
|
||||
?arg
|
||||
)
|
||||
& !a
|
||||
"&"
|
||||
( !c:"<"<
|
||||
| !c:"&"&
|
||||
| quot
|
||||
)
|
||||
";"
|
||||
attributeValueEntities$!arg
|
||||
| !arg
|
||||
)
|
||||
& ( PCDATAentities
|
||||
= a c
|
||||
. @( !arg
|
||||
: ?a
|
||||
(("<"|"&"|">"):?c)
|
||||
?arg
|
||||
)
|
||||
& !a
|
||||
"&"
|
||||
( !c:"<"<
|
||||
| !c:"&"&
|
||||
| gt
|
||||
)
|
||||
";"
|
||||
PCDATAentities$!arg
|
||||
| !arg
|
||||
)
|
||||
& ( doAttributes
|
||||
= a v
|
||||
. !arg:(?a.?v) ?arg
|
||||
& " "
|
||||
PCDATAentities$!a
|
||||
"=\""
|
||||
attributeValueEntities$!v
|
||||
\"
|
||||
doAttributes$!arg
|
||||
|
|
||||
)
|
||||
& ( doAll
|
||||
= xml first A B C att XML
|
||||
. !arg:?xml
|
||||
& :?XML
|
||||
& whl
|
||||
' ( !xml:%?first ?xml
|
||||
& ( !first:(?A.?B)
|
||||
& ( !B:(?att,?C)
|
||||
& !XML
|
||||
( !C:
|
||||
& "<" !A doAttributes$!att " />\n"
|
||||
| "<"
|
||||
!A
|
||||
doAttributes$!att
|
||||
">"
|
||||
doAll$!C
|
||||
"</"
|
||||
!A
|
||||
">\n"
|
||||
)
|
||||
: ?XML
|
||||
| !A
|
||||
: ( "!"&!XML "<!" !B ">":?XML
|
||||
| "!--"
|
||||
& !XML "<!--" !B "-->":?XML
|
||||
| "?"&!XML "<?" !B "?>\n":?XML
|
||||
| "![CDATA["
|
||||
& !XML "<![CDATA[" !B "]]>":?XML
|
||||
| "!DOCTYPE"
|
||||
& !XML "<!DOCTYPE" !B ">":?XML
|
||||
| ?
|
||||
& !XML "<" !A doAttributes$!B ">":?XML
|
||||
)
|
||||
)
|
||||
| !XML PCDATAentities$!first:?XML
|
||||
)
|
||||
)
|
||||
& str$!XML
|
||||
)
|
||||
& doAll$!arg
|
||||
)
|
||||
& ( makeList
|
||||
= characters name names remark remarks
|
||||
. !arg:(?names.?remarks)
|
||||
& :?characters
|
||||
& whl
|
||||
' ( (!names.!remarks)
|
||||
: (%?name ?names.%?remark ?remarks)
|
||||
& !characters (Character.(name.!name),!remark)
|
||||
: ?characters
|
||||
)
|
||||
& ("?".xml) (CharacterRemarks.,!characters)
|
||||
)
|
||||
& put
|
||||
$ ( 2XML
|
||||
$ ( makeList
|
||||
$ ( April "Tam O'Shanter" Emily
|
||||
. "Bubbly: I'm > Tam and <= Emily"
|
||||
"Burns: \"When chapman billies leave the street ...\""
|
||||
"Short & shrift"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
5
Task/XML-Output/Bracmat/xml-output-2.bracmat
Normal file
5
Task/XML-Output/Bracmat/xml-output-2.bracmat
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml?>
|
||||
<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