summary refs log tree commit diff stats
path: root/lib/pure/xmltree.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure/xmltree.nim')
-rw-r--r--lib/pure/xmltree.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pure/xmltree.nim b/lib/pure/xmltree.nim
index 3c789d841..c783158ea 100644
--- a/lib/pure/xmltree.nim
+++ b/lib/pure/xmltree.nim
@@ -115,11 +115,21 @@ proc `[]`* (n: XmlNode, i: int): XmlNode {.inline.} =
   assert n.k == xnElement
   result = n.s[i]
 
+proc mget* (n: var XmlNode, i: int): var XmlNode {.inline.} = 
+  ## returns the `i`'th child of `n` so that it can be modified
+  assert n.k == xnElement
+  result = n.s[i]
+
 iterator items*(n: XmlNode): XmlNode {.inline.} = 
   ## iterates over any child of `n`.
   assert n.k == xnElement
   for i in 0 .. n.len-1: yield n[i]
 
+iterator mitems*(n: var XmlNode): var XmlNode {.inline.} = 
+  ## iterates over any child of `n`.
+  assert n.k == xnElement
+  for i in 0 .. n.len-1: yield mget(n, i)
+
 proc attrs*(n: XmlNode): XmlAttributes {.inline.} = 
   ## gets the attributes belonging to `n`.
   ## Returns `nil` if attributes have not been initialised for this node.