1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
discard """
output: '''
<xml>
<head>
<div>Some text</div>
<div>Some more text </div>
</head>
<body>
<div>Some text in body</div>
<div>Some more text in body </div>
</body>
</xml>
'''
"""
# Test xmltree add/insert/delete/replace operations
import xmlparser
import xmltree
let initialDocBase = """
<xml>
<head>
<div>Some text</div>
<div>Some more text </div>
</head>
<tag>
<div>MORE TEXT </div>
<div>MORE TEXT Some more text</div>
</tag>
<tag>
<div>MORE TEXT </div>
<div>MORE TEXT Some more text</div>
</tag>
<body>
<div>Some text in body</div>
<div>Some more text in body </div>
</body>
</xml>
"""
var initialDocBaseTree = parseXml(initialDocBase)
proc test_delete() =
var testDoc = initialDocBaseTree
testDoc.delete(1)
testDoc.delete(1)
echo $testDoc
test_delete()
|