ttree_delete1.nim 853 B

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