How to resolve the algorithm XML/Output step by step in the Forth programming language
How to resolve the algorithm XML/Output step by step in the Forth programming language
Table of Contents
Problem Statement
Create a function that takes a list of character names and a list of corresponding remarks and returns an XML document of
Let's start with the solution:
Step by Step solution about How to resolve the algorithm XML/Output step by step in the Forth programming language
Source code in the forth programming language
include ffl/est.fs
include ffl/xos.fs
\ Input lists
0 value names
here ," Emily"
here ," Tam O'Shanter"
here ," April"
here to names
, , ,
0 value remarks
here ," Short & shrift"
here ,\" Burns: \"When chapman billies leave the street ...\""
here ," Bubbly: I'm > Tam and <= Emily"
here to remarks
, , ,
: s++ ( c-addr1 -- c-addr2 c-addr3 u3 )
dup cell+ swap @ count
;
\ Create xml writer
tos-create xml
: create-xml ( c-addr1 c-addr2 -- )
0 s" CharacterRemarks" xml xos-write-start-tag
3 0 DO
swap s++ s" name" 2swap 1
s" Character" xml xos-write-start-tag
swap s++ xml xos-write-text
s" Character" xml xos-write-end-tag
LOOP
drop drop
s" CharacterRemarks" xml xos-write-end-tag
;
names remarks create-xml
\ Output xml string
xml str-get type cr
You may also check:How to resolve the algorithm Hello world/Standard error step by step in the Pike programming language
You may also check:How to resolve the algorithm Reverse words in a string step by step in the Frink programming language
You may also check:How to resolve the algorithm Binary search step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Jacobsthal numbers step by step in the Red programming language
You may also check:How to resolve the algorithm Self-describing numbers step by step in the RPL programming language