Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
29
Task/XML-DOM-serialization/Forth/xml-dom-serialization.fth
Normal file
29
Task/XML-DOM-serialization/Forth/xml-dom-serialization.fth
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
include ffl/dom.fs
|
||||
|
||||
\ Create a dom variable 'doc' in the dictionary
|
||||
|
||||
dom-create doc
|
||||
|
||||
\ Add the document root with its version attribute
|
||||
|
||||
dom.document doc dom-append-node
|
||||
|
||||
s" version" s" 1.0" dom.attribute doc dom-append-node
|
||||
|
||||
\ Add root and element
|
||||
|
||||
doc dom-parent 2drop
|
||||
|
||||
s" root" dom.element doc dom-append-node
|
||||
|
||||
s" element" dom.element doc dom-append-node
|
||||
|
||||
\ Add the text
|
||||
|
||||
s" Some text here" dom.text doc dom-append-node
|
||||
|
||||
\ Convert the document to a string and print
|
||||
|
||||
doc dom-write-string [IF]
|
||||
type cr
|
||||
[THEN]
|
||||
Loading…
Add table
Add a link
Reference in a new issue