Files
Nim/xmltree.html
github-actions[bot] c7440eccf2 Deploy to GitHub pages
2025-09-27 04:02:34 +00:00

1418 lines
165 KiB
HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/xmltree</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/xmltree</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#XmlAttributes" title="XmlAttributes = StringTableRef">XmlAttributes</a></li>
<li><a class="reference" href="#XmlNode" title="XmlNode = ref XmlNodeObj">XmlNode</a></li>
<li><a class="reference" href="#XmlNodeKind" title="XmlNodeKind = enum
xnText, ## a text element
xnVerbatimText, xnElement, ## an element with 0 or more children
xnCData, ## a CDATA node
xnEntity, ## an entity (like ``&amp;thing;``)
xnComment ## an XML comment">XmlNodeKind</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#xmlHeader" title="xmlHeader = &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot; ?&gt;\n&quot;">xmlHeader</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CXmlNode" title="`$`(n: XmlNode): string">`$`(n: XmlNode): string</a></li>
</ul>
<ul class="simple nested-toc-section">[]
<li><a class="reference" href="#%5B%5D%2CXmlNode%2Cint_2" title="`[]`(n: var XmlNode; i: int): var XmlNode">`[]`(n: var XmlNode; i: int): var XmlNode</a></li>
<li><a class="reference" href="#%5B%5D%2CXmlNode%2Cint" title="`[]`(n: XmlNode; i: int): XmlNode">`[]`(n: XmlNode; i: int): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">add
<li><a class="reference" href="#add%2CXmlNode%2CXmlNode" title="add(father, son: XmlNode)">add(father, son: XmlNode)</a></li>
<li><a class="reference" href="#add%2CXmlNode%2CopenArray%5BXmlNode%5D" title="add(father: XmlNode; sons: openArray[XmlNode])">add(father: XmlNode; sons: openArray[XmlNode])</a></li>
<li><a class="reference" href="#add%2Cstring%2CXmlNode%2Cint%2Cint" title="add(result: var string; n: XmlNode; indent = 0; indWidth = 2; addNewLines = true)">add(result: var string; n: XmlNode; indent = 0; indWidth = 2; addNewLines = true)</a></li>
</ul>
<ul class="simple nested-toc-section">addEscaped
<li><a class="reference" href="#addEscaped%2Cstring%2Cstring" title="addEscaped(result: var string; s: string)">addEscaped(result: var string; s: string)</a></li>
</ul>
<ul class="simple nested-toc-section">attr
<li><a class="reference" href="#attr%2CXmlNode%2Cstring" title="attr(n: XmlNode; name: string): string">attr(n: XmlNode; name: string): string</a></li>
</ul>
<ul class="simple nested-toc-section">attrs
<li><a class="reference" href="#attrs%2CXmlNode" title="attrs(n: XmlNode): XmlAttributes">attrs(n: XmlNode): XmlAttributes</a></li>
</ul>
<ul class="simple nested-toc-section">attrs=
<li><a class="reference" href="#attrs%3D%2CXmlNode%2CXmlAttributes" title="attrs=(n: XmlNode; attr: XmlAttributes)">attrs=(n: XmlNode; attr: XmlAttributes)</a></li>
</ul>
<ul class="simple nested-toc-section">attrsLen
<li><a class="reference" href="#attrsLen%2CXmlNode" title="attrsLen(n: XmlNode): int">attrsLen(n: XmlNode): int</a></li>
</ul>
<ul class="simple nested-toc-section">child
<li><a class="reference" href="#child%2CXmlNode%2Cstring" title="child(n: XmlNode; name: string): XmlNode">child(n: XmlNode; name: string): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">clear
<li><a class="reference" href="#clear%2CXmlNode" title="clear(n: var XmlNode)">clear(n: var XmlNode)</a></li>
</ul>
<ul class="simple nested-toc-section">clientData
<li><a class="reference" href="#clientData%2CXmlNode" title="clientData(n: XmlNode): int">clientData(n: XmlNode): int</a></li>
</ul>
<ul class="simple nested-toc-section">clientData=
<li><a class="reference" href="#clientData%3D%2CXmlNode%2Cint" title="clientData=(n: XmlNode; data: int)">clientData=(n: XmlNode; data: int)</a></li>
</ul>
<ul class="simple nested-toc-section">delete
<li><a class="reference" href="#delete%2CXmlNode%2CNatural" title="delete(n: XmlNode; i: Natural)">delete(n: XmlNode; i: Natural)</a></li>
<li><a class="reference" href="#delete%2CXmlNode%2CSlice%5Bint%5D" title="delete(n: XmlNode; slice: Slice[int])">delete(n: XmlNode; slice: Slice[int])</a></li>
</ul>
<ul class="simple nested-toc-section">escape
<li><a class="reference" href="#escape%2Cstring" title="escape(s: string): string">escape(s: string): string</a></li>
</ul>
<ul class="simple nested-toc-section">findAll
<li><a class="reference" href="#findAll%2CXmlNode%2Cstring" title="findAll(n: XmlNode; tag: string; caseInsensitive = false): seq[XmlNode]">findAll(n: XmlNode; tag: string; caseInsensitive = false): seq[XmlNode]</a></li>
<li><a class="reference" href="#findAll%2CXmlNode%2Cstring%2Cseq%5BXmlNode%5D" title="findAll(n: XmlNode; tag: string; result: var seq[XmlNode];
caseInsensitive = false)">findAll(n: XmlNode; tag: string; result: var seq[XmlNode];
caseInsensitive = false)</a></li>
</ul>
<ul class="simple nested-toc-section">innerText
<li><a class="reference" href="#innerText%2CXmlNode" title="innerText(n: XmlNode): string">innerText(n: XmlNode): string</a></li>
</ul>
<ul class="simple nested-toc-section">insert
<li><a class="reference" href="#insert%2CXmlNode%2CXmlNode%2Cint" title="insert(father, son: XmlNode; index: int)">insert(father, son: XmlNode; index: int)</a></li>
<li><a class="reference" href="#insert%2CXmlNode%2CopenArray%5BXmlNode%5D%2Cint" title="insert(father: XmlNode; sons: openArray[XmlNode]; index: int)">insert(father: XmlNode; sons: openArray[XmlNode]; index: int)</a></li>
</ul>
<ul class="simple nested-toc-section">kind
<li><a class="reference" href="#kind%2CXmlNode" title="kind(n: XmlNode): XmlNodeKind">kind(n: XmlNode): XmlNodeKind</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CXmlNode" title="len(n: XmlNode): int">len(n: XmlNode): int</a></li>
</ul>
<ul class="simple nested-toc-section">newCData
<li><a class="reference" href="#newCData%2Csinkstring" title="newCData(cdata: sink string): XmlNode">newCData(cdata: sink string): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">newComment
<li><a class="reference" href="#newComment%2Csinkstring" title="newComment(comment: sink string): XmlNode">newComment(comment: sink string): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">newElement
<li><a class="reference" href="#newElement%2Csinkstring" title="newElement(tag: sink string): XmlNode">newElement(tag: sink string): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">newEntity
<li><a class="reference" href="#newEntity%2Cstring" title="newEntity(entity: string): XmlNode">newEntity(entity: string): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">newText
<li><a class="reference" href="#newText%2Csinkstring" title="newText(text: sink string): XmlNode">newText(text: sink string): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">newVerbatimText
<li><a class="reference" href="#newVerbatimText%2Csinkstring" title="newVerbatimText(text: sink string): XmlNode">newVerbatimText(text: sink string): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">newXmlTree
<li><a class="reference" href="#newXmlTree%2Csinkstring%2CopenArray%5BXmlNode%5D%2CXmlAttributes" title="newXmlTree(tag: sink string; children: openArray[XmlNode];
attributes: XmlAttributes = nil): XmlNode">newXmlTree(tag: sink string; children: openArray[XmlNode];
attributes: XmlAttributes = nil): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">rawTag
<li><a class="reference" href="#rawTag%2CXmlNode" title="rawTag(n: XmlNode): string">rawTag(n: XmlNode): string</a></li>
</ul>
<ul class="simple nested-toc-section">rawText
<li><a class="reference" href="#rawText%2CXmlNode" title="rawText(n: XmlNode): string">rawText(n: XmlNode): string</a></li>
</ul>
<ul class="simple nested-toc-section">replace
<li><a class="reference" href="#replace%2CXmlNode%2CNatural%2CopenArray%5BXmlNode%5D" title="replace(n: XmlNode; i: Natural; replacement: openArray[XmlNode])">replace(n: XmlNode; i: Natural; replacement: openArray[XmlNode])</a></li>
<li><a class="reference" href="#replace%2CXmlNode%2CSlice%5Bint%5D%2CopenArray%5BXmlNode%5D" title="replace(n: XmlNode; slice: Slice[int]; replacement: openArray[XmlNode])">replace(n: XmlNode; slice: Slice[int]; replacement: openArray[XmlNode])</a></li>
</ul>
<ul class="simple nested-toc-section">tag
<li><a class="reference" href="#tag%2CXmlNode" title="tag(n: XmlNode): lent string">tag(n: XmlNode): lent string</a></li>
</ul>
<ul class="simple nested-toc-section">tag=
<li><a class="reference" href="#tag%3D%2CXmlNode%2Csinkstring" title="tag=(n: XmlNode; tag: sink string)">tag=(n: XmlNode; tag: sink string)</a></li>
</ul>
<ul class="simple nested-toc-section">text
<li><a class="reference" href="#text%2CXmlNode" title="text(n: XmlNode): lent string">text(n: XmlNode): lent string</a></li>
</ul>
<ul class="simple nested-toc-section">text=
<li><a class="reference" href="#text%3D%2CXmlNode%2Csinkstring" title="text=(n: XmlNode; text: sink string)">text=(n: XmlNode; text: sink string)</a></li>
</ul>
<ul class="simple nested-toc-section">toXmlAttributes
<li><a class="reference" href="#toXmlAttributes%2Cvarargs%5Btuple%5Bstring%2Cstring%5D%5D" title="toXmlAttributes(keyValuePairs: varargs[tuple[key, val: string]]): XmlAttributes">toXmlAttributes(keyValuePairs: varargs[tuple[key, val: string]]): XmlAttributes</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">items
<li><a class="reference" href="#items.i%2CXmlNode" title="items(n: XmlNode): XmlNode">items(n: XmlNode): XmlNode</a></li>
</ul>
<ul class="simple nested-toc-section">mitems
<li><a class="reference" href="#mitems.i%2CXmlNode" title="mitems(n: var XmlNode): var XmlNode">mitems(n: var XmlNode): var XmlNode</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#17" id="67">Macros</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section"><>
<li><a class="reference" href="#%3C%3E.m%2Cuntyped" title="`&lt;&gt;`(x: untyped): untyped">`&lt;&gt;`(x: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">A simple XML tree generator.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">xmltree</span>
<span class="Keyword">var</span> <span class="Identifier">g</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;some text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newComment</span><span class="Punctuation">(</span><span class="StringLit">&quot;this is comment&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">var</span> <span class="Identifier">h</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;secondTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">h</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;some entity&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">att</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;first value&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;second value&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">toXmlAttributes</span>
<span class="Keyword">let</span> <span class="Identifier">k</span> <span class="Operator">=</span> <span class="Identifier">newXmlTree</span><span class="Punctuation">(</span><span class="StringLit">&quot;treeTag&quot;</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="Identifier">g</span><span class="Punctuation">,</span> <span class="Identifier">h</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">att</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Operator">$</span><span class="Identifier">k</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;treeTag key1=&quot;first value&quot; key2=&quot;second value&quot;&gt;
&lt;myTag&gt;some text&lt;!-- this is comment --&gt;&lt;/myTag&gt;
&lt;secondTag&gt;&amp;some entity;&lt;/secondTag&gt;
&lt;/treeTag&gt;&quot;&quot;&quot;</span></pre><strong>See also:</strong><ul class="simple"><li><a class="reference external" href="xmlparser.html">xmlparser module</a> for high-level XML parsing</li>
<li><a class="reference external" href="parsexml.html">parsexml module</a> for low-level XML parsing</li>
<li><a class="reference external" href="htmlgen.html">htmlgen module</a> for html code generator</li>
</ul>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="since.html">since</a>, <a class="reference external" href="macros.html">macros</a>, <a class="reference external" href="strtabs.html">strtabs</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="sequtils.html">sequtils</a>, <a class="reference external" href="assertions.html">assertions</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="XmlAttributes">
<dt><pre><a href="xmltree.html#XmlAttributes"><span class="Identifier">XmlAttributes</span></a> <span class="Other">=</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a></pre></dt>
<dd>
<p>An alias for a string to string mapping.</p>
<p>Use <a class="reference external" href="#toXmlAttributes,varargs[tuple[string,string]]">toXmlAttributes proc</a> to create <tt class="docutils literal"><span class="pre"><span class="Identifier">XmlAttributes</span></span></tt>.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L54" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L54" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="XmlNode">
<dt><pre><a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Identifier">XmlNodeObj</span></pre></dt>
<dd>
<p>An XML tree consisting of XML nodes.</p>
<p>Use <a class="reference external" href="#newXmlTree,string,openArray[XmlNode],XmlAttributes">newXmlTree proc</a> for creating a new tree.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="XmlNodeKind">
<dt><pre><a href="xmltree.html#XmlNodeKind"><span class="Identifier">XmlNodeKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">xnText</span><span class="Other">,</span> <span class="Comment">## a text element</span>
<span class="Identifier">xnVerbatimText</span><span class="Other">,</span> <span class="Identifier">xnElement</span><span class="Other">,</span> <span class="Comment">## an element with 0 or more children</span>
<span class="Identifier">xnCData</span><span class="Other">,</span> <span class="Comment">## a CDATA node</span>
<span class="Identifier">xnEntity</span><span class="Other">,</span> <span class="Comment">## an entity (like ``&amp;thing;``)</span>
<span class="Identifier">xnComment</span> <span class="Comment">## an XML comment</span></pre></dt>
<dd>
Different kinds of XML nodes.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L46" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L46" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="xmlHeader">
<dt><pre><a href="xmltree.html#xmlHeader"><span class="Identifier">xmlHeader</span></a> <span class="Other">=</span> <span class="StringLit">&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot; ?&gt;\n&quot;</span></pre></dt>
<dd>
Header to use for complete XML output.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L70" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L70" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CXmlNode"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Converts <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> into its string representation.</p>
<p>No <tt class="docutils literal"><span class="pre">&lt;$xml ...$&gt;</span></tt> declaration is produced, so that the produced XML fragments are composable.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L830" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L830" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="[]-procs-all">
<div id="[],XmlNode,int_2">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CXmlNode%2Cint_2"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the <tt class="docutils literal"><span class="pre"><span class="Identifier">i</span></span></tt>'th child of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> so that it can be modified.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L540" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L540" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="[],XmlNode,int">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CXmlNode%2Cint"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the <tt class="docutils literal"><span class="pre"><span class="Identifier">i</span></span></tt>'th child of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;first&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;second&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;first /&gt;&quot;</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;second /&gt;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L528" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L528" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="add-procs-all">
<div id="add,XmlNode,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#add%2CXmlNode%2CXmlNode"><span class="Identifier">add</span></a><span class="Other">(</span><span class="Identifier">father</span><span class="Other">,</span> <span class="Identifier">son</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Adds the child <tt class="docutils literal"><span class="pre"><span class="Identifier">son</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">father</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">father</span></span></tt> must be of <tt class="docutils literal"><span class="pre"><span class="Identifier">xnElement</span></span></tt> type</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#add,XmlNode,openArray[XmlNode]">add proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,XmlNode,int">insert proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,openArray[XmlNode],int">insert proc</a></li>
<li><a class="reference external" href="#delete,XmlNode,Natural">delete proc</a></li>
<li><a class="reference external" href="#delete.XmlNode,Slice[int]">delete proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,int,openArray[XmlNode]">replace proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,Slice[int],openArray[XmlNode]">replace proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;my text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;sonTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;my entity&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;myTag&gt;my text&lt;sonTag /&gt;&amp;my entity;&lt;/myTag&gt;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L307" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L307" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="add,XmlNode,openArray[XmlNode]">
<dt><pre><span class="Keyword">proc</span> <a href="#add%2CXmlNode%2CopenArray%5BXmlNode%5D"><span class="Identifier">add</span></a><span class="Other">(</span><span class="Identifier">father</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">sons</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Adds the children <tt class="docutils literal"><span class="pre"><span class="Identifier">sons</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">father</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">father</span></span></tt> must be of <tt class="docutils literal"><span class="pre"><span class="Identifier">xnElement</span></span></tt> type</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#add,XmlNode,XmlNode">add proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,XmlNode,int">insert proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,openArray[XmlNode],int">insert proc</a></li>
<li><a class="reference external" href="#delete,XmlNode,Natural">delete proc</a></li>
<li><a class="reference external" href="#delete.XmlNode,Slice[int]">delete proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,int,openArray[XmlNode]">replace proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,Slice[int],openArray[XmlNode]">replace proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;my text&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;sonTag&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;my entity&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;myTag&gt;my text&lt;sonTag /&gt;&amp;my entity;&lt;/myTag&gt;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L329" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L329" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="add,string,XmlNode,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#add%2Cstring%2CXmlNode%2Cint%2Cint"><span class="Identifier">add</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">indent</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">indWidth</span> <span class="Other">=</span> <span class="DecNumber">2</span><span class="Other">;</span>
<span class="Identifier">addNewLines</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Adds the textual representation of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> to string <tt class="docutils literal"><span class="pre"><span class="Identifier">result</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;firstTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;my text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">newComment</span><span class="Punctuation">(</span><span class="StringLit">&quot;my comment&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">s</span> <span class="Operator">=</span> <span class="StringLit">&quot;&quot;</span>
<span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="Identifier">c</span><span class="Punctuation">)</span>
<span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span>
<span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">s</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;!-- my comment --&gt;&lt;firstTag /&gt;my text&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L815" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L815" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="addEscaped-procs-all">
<div id="addEscaped,string,string">
<dt><pre><span class="Keyword">proc</span> <a href="#addEscaped%2Cstring%2Cstring"><span class="Identifier">addEscaped</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
The same as <a class="reference external" href="#escape,string">result.add(escape(s))</a>, but more efficient.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L700" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L700" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="attr-procs-all">
<div id="attr,XmlNode,string">
<dt><pre><span class="Keyword">proc</span> <a href="#attr%2CXmlNode%2Cstring"><span class="Identifier">attr</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Finds the first attribute of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> with a name of <tt class="docutils literal"><span class="pre"><span class="Identifier">name</span></span></tt>. Returns &quot;&quot; on failure.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#attrs,XmlNode">attrs proc</a> for XmlAttributes getter</li>
<li><a class="reference external" href="#attrs=,XmlNode,XmlAttributes">attrs= proc</a> for XmlAttributes setter</li>
<li><a class="reference external" href="#attrsLen,XmlNode">attrsLen proc</a> for number of attributes</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">j</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">att</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;first value&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;second value&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">toXmlAttributes</span>
<span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">=</span> <span class="Identifier">att</span>
<span class="Identifier">assert</span> <span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attr</span><span class="Punctuation">(</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;first value&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attr</span><span class="Punctuation">(</span><span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;second value&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L669" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L669" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="attrs-procs-all">
<div id="attrs,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#attrs%2CXmlNode"><span class="Identifier">attrs</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlAttributes"><span class="Identifier">XmlAttributes</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Gets the attributes belonging to <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Keyword">nil</span></span></tt> if attributes have not been initialised for this node.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#attrs=,XmlNode,XmlAttributes">attrs= proc</a> for XmlAttributes setter</li>
<li><a class="reference external" href="#attrsLen,XmlNode">attrsLen proc</a> for number of attributes</li>
<li><a class="reference external" href="#attr,XmlNode,string">attr proc</a> for finding an attribute</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">j</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">==</span> <span class="Keyword">nil</span>
<span class="Keyword">let</span> <span class="Identifier">att</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;first value&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;second value&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">toXmlAttributes</span>
<span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">=</span> <span class="Identifier">att</span>
<span class="Identifier">assert</span> <span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">==</span> <span class="Identifier">att</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L615" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L615" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="attrs=-procs-all">
<div id="attrs=,XmlNode,XmlAttributes">
<dt><pre><span class="Keyword">proc</span> <a href="#attrs%3D%2CXmlNode%2CXmlAttributes"><span class="Identifier">attrs=</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">attr</span><span class="Other">:</span> <a href="xmltree.html#XmlAttributes"><span class="Identifier">XmlAttributes</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Sets the attributes belonging to <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#attrs,XmlNode">attrs proc</a> for XmlAttributes getter</li>
<li><a class="reference external" href="#attrsLen,XmlNode">attrsLen proc</a> for number of attributes</li>
<li><a class="reference external" href="#attr,XmlNode,string">attr proc</a> for finding an attribute</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">j</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">==</span> <span class="Keyword">nil</span>
<span class="Keyword">let</span> <span class="Identifier">att</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;first value&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;second value&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">toXmlAttributes</span>
<span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">=</span> <span class="Identifier">att</span>
<span class="Identifier">assert</span> <span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">==</span> <span class="Identifier">att</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L634" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L634" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="attrsLen-procs-all">
<div id="attrsLen,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#attrsLen%2CXmlNode"><span class="Identifier">attrsLen</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the number of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>'s attributes.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#attrs,XmlNode">attrs proc</a> for XmlAttributes getter</li>
<li><a class="reference external" href="#attrs=,XmlNode,XmlAttributes">attrs= proc</a> for XmlAttributes setter</li>
<li><a class="reference external" href="#attr,XmlNode,string">attr proc</a> for finding an attribute</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">j</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrsLen</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
<span class="Keyword">let</span> <span class="Identifier">att</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;first value&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;second value&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">toXmlAttributes</span>
<span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">=</span> <span class="Identifier">att</span>
<span class="Identifier">assert</span> <span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrsLen</span> <span class="Operator">==</span> <span class="DecNumber">2</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L651" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L651" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="child-procs-all">
<div id="child,XmlNode,string">
<dt><pre><span class="Keyword">proc</span> <a href="#child%2CXmlNode%2Cstring"><span class="Identifier">child</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Finds the first child element of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> with a name of <tt class="docutils literal"><span class="pre"><span class="Identifier">name</span></span></tt>. Returns <tt class="docutils literal"><span class="pre"><span class="Keyword">nil</span></span></tt> on failure.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;firstSon&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;secondSon&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;thirdSon&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">child</span><span class="Punctuation">(</span><span class="StringLit">&quot;secondSon&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;secondSon /&gt;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L838" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L838" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clear-procs-all">
<div id="clear,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CXmlNode"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Recursively clears all children of an XmlNode.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">g</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;some text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newComment</span><span class="Punctuation">(</span><span class="StringLit">&quot;this is comment&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">var</span> <span class="Identifier">h</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;secondTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">h</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;some entity&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">att</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;first value&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;second value&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">toXmlAttributes</span>
<span class="Keyword">var</span> <span class="Identifier">k</span> <span class="Operator">=</span> <span class="Identifier">newXmlTree</span><span class="Punctuation">(</span><span class="StringLit">&quot;treeTag&quot;</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="Identifier">g</span><span class="Punctuation">,</span> <span class="Identifier">h</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">att</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Operator">$</span><span class="Identifier">k</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;treeTag key1=&quot;first value&quot; key2=&quot;second value&quot;&gt;
&lt;myTag&gt;some text&lt;!-- this is comment --&gt;&lt;/myTag&gt;
&lt;secondTag&gt;&amp;some entity;&lt;/secondTag&gt;
&lt;/treeTag&gt;&quot;&quot;&quot;</span>
<span class="Identifier">clear</span><span class="Punctuation">(</span><span class="Identifier">k</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Operator">$</span><span class="Identifier">k</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;treeTag key1=&quot;first value&quot; key2=&quot;second value&quot; /&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L545" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L545" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clientData-procs-all">
<div id="clientData,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#clientData%2CXmlNode"><span class="Identifier">clientData</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Gets the client data of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p>The client data field is used by the HTML parser and generator.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L688" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L688" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clientData=-procs-all">
<div id="clientData=,XmlNode,int">
<dt><pre><span class="Keyword">proc</span> <a href="#clientData%3D%2CXmlNode%2Cint"><span class="Identifier">clientData=</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Sets the client data of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p>The client data field is used by the HTML parser and generator.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L694" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L694" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="delete-procs-all">
<div id="delete,XmlNode,Natural">
<dt><pre><span class="Keyword">proc</span> <a href="#delete%2CXmlNode%2CNatural"><span class="Identifier">delete</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#Natural"><span class="Identifier">Natural</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Deletes the <tt class="docutils literal"><span class="pre"><span class="Identifier">i</span></span></tt>'th child of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#delete.XmlNode,Slice[int]">delete proc</a></li>
<li><a class="reference external" href="#add,XmlNode,XmlNode">add proc</a></li>
<li><a class="reference external" href="#add,XmlNode,openArray[XmlNode]">add proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,XmlNode,int">insert proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,openArray[XmlNode],int">insert proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,int,openArray[XmlNode]">replace proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,Slice[int],openArray[XmlNode]">replace proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;first&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;second&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">delete</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;myTag&gt;
&lt;first /&gt;
&lt;/myTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L407" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L407" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="delete,XmlNode,Slice[int]">
<dt><pre><span class="Keyword">proc</span> <a href="#delete%2CXmlNode%2CSlice%5Bint%5D"><span class="Identifier">delete</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Deletes the items <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span><span class="Punctuation">[</span><span class="Identifier">slice</span><span class="Punctuation">]</span></span></tt> of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#delete.XmlNode,int">delete proc</a></li>
<li><a class="reference external" href="#add,XmlNode,XmlNode">add proc</a></li>
<li><a class="reference external" href="#add,XmlNode,openArray[XmlNode]">add proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,XmlNode,int">insert proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,openArray[XmlNode],int">insert proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,int,openArray[XmlNode]">replace proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,Slice[int],openArray[XmlNode]">replace proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;first&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;second&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;third&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">delete</span><span class="Punctuation">(</span><span class="FloatNumber">0.</span><span class="Operator">.</span><span class="DecNumber">1</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;myTag&gt;
&lt;first /&gt;
&lt;/myTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L430" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L430" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="escape-procs-all">
<div id="escape,string">
<dt><pre><span class="Keyword">proc</span> <a href="#escape%2Cstring"><span class="Identifier">escape</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Escapes <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> for inclusion into an XML document.</p>
<p>Escapes these characters:</p>
<table border="1" class="docutils"><tr><th>char</th><th>is converted to</th></tr>
<tr><td><tt class="docutils literal"><span class="pre">&lt;</span></tt></td><td><tt class="docutils literal"><span class="pre">&amp;lt;</span></tt></td></tr>
<tr><td><tt class="docutils literal"><span class="pre">&gt;</span></tt></td><td><tt class="docutils literal"><span class="pre">&amp;gt;</span></tt></td></tr>
<tr><td><tt class="docutils literal"><span class="pre">&amp;</span></tt></td><td><tt class="docutils literal"><span class="pre">&amp;amp;</span></tt></td></tr>
<tr><td><tt class="docutils literal"><span class="pre">&quot;</span></tt></td><td><tt class="docutils literal"><span class="pre">&amp;quot;</span></tt></td></tr>
<tr><td><tt class="docutils literal"><span class="pre">'</span></tt></td><td><tt class="docutils literal"><span class="pre">&amp;apos;</span></tt></td></tr>
</table><p>You can also use <a class="reference external" href="#addEscaped,string,string">addEscaped proc</a>.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L711" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L711" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="findAll-procs-all">
<div id="findAll,XmlNode,string">
<dt><pre><span class="Keyword">proc</span> <a href="#findAll%2CXmlNode%2Cstring"><span class="Identifier">findAll</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">tag</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">caseInsensitive</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
A shortcut version to assign in let blocks.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span>
<span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;good&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;bad&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">d</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;BAD&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">e</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;GOOD&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">b</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;b text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;c text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">d</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;d text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;e text&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">newXmlTree</span><span class="Punctuation">(</span><span class="StringLit">&quot;father&quot;</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="Identifier">b</span><span class="Punctuation">,</span> <span class="Identifier">c</span><span class="Punctuation">,</span> <span class="Identifier">d</span><span class="Punctuation">,</span> <span class="Identifier">e</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;good&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[&lt;good&gt;b text&lt;/good&gt;]&quot;</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;BAD&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[&lt;BAD&gt;d text&lt;/BAD&gt;]&quot;</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;good&quot;</span><span class="Punctuation">,</span> <span class="Identifier">caseInsensitive</span> <span class="Operator">=</span> <span class="Identifier">true</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[&lt;good&gt;b text&lt;/good&gt;, &lt;GOOD&gt;e text&lt;/GOOD&gt;]&quot;</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;BAD&quot;</span><span class="Punctuation">,</span> <span class="Identifier">caseInsensitive</span> <span class="Operator">=</span> <span class="Identifier">true</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[&lt;bad&gt;c text&lt;/bad&gt;, &lt;BAD&gt;d text&lt;/BAD&gt;]&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L893" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L893" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="findAll,XmlNode,string,seq[XmlNode]">
<dt><pre><span class="Keyword">proc</span> <a href="#findAll%2CXmlNode%2Cstring%2Cseq%5BXmlNode%5D"><span class="Identifier">findAll</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">tag</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">caseInsensitive</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Iterates over all the children of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> returning those matching <tt class="docutils literal"><span class="pre"><span class="Identifier">tag</span></span></tt>.</p>
<p>Found nodes satisfying the condition will be appended to the <tt class="docutils literal"><span class="pre"><span class="Identifier">result</span></span></tt> sequence.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span>
<span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;good&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;bad&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">d</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;BAD&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">e</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;GOOD&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">b</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;b text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;c text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">d</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;d text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;e text&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">newXmlTree</span><span class="Punctuation">(</span><span class="StringLit">&quot;father&quot;</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="Identifier">b</span><span class="Punctuation">,</span> <span class="Identifier">c</span><span class="Punctuation">,</span> <span class="Identifier">d</span><span class="Punctuation">,</span> <span class="Identifier">e</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Keyword">var</span> <span class="Identifier">s</span> <span class="Operator">=</span> <span class="Identifier">newSeq</span><span class="Punctuation">[</span><span class="Identifier">XmlNode</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;good&quot;</span><span class="Punctuation">,</span> <span class="Identifier">s</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">s</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[&lt;good&gt;b text&lt;/good&gt;]&quot;</span>
<span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">setLen</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;good&quot;</span><span class="Punctuation">,</span> <span class="Identifier">s</span><span class="Punctuation">,</span> <span class="Identifier">caseInsensitive</span> <span class="Operator">=</span> <span class="Identifier">true</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">s</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[&lt;good&gt;b text&lt;/good&gt;, &lt;GOOD&gt;e text&lt;/GOOD&gt;]&quot;</span>
<span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">setLen</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;BAD&quot;</span><span class="Punctuation">,</span> <span class="Identifier">s</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">s</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[&lt;BAD&gt;d text&lt;/BAD&gt;]&quot;</span>
<span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">setLen</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;BAD&quot;</span><span class="Punctuation">,</span> <span class="Identifier">s</span><span class="Punctuation">,</span> <span class="Identifier">caseInsensitive</span> <span class="Operator">=</span> <span class="Identifier">true</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">s</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[&lt;bad&gt;c text&lt;/bad&gt;, &lt;BAD&gt;d text&lt;/BAD&gt;]&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L854" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L854" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="innerText-procs-all">
<div id="innerText,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#innerText%2CXmlNode"><span class="Identifier">innerText</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Gets the inner text of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>:<ul class="simple"><li>If <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">xnText</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">xnEntity</span></span></tt>, returns its content.</li>
<li>If <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">xnElement</span></span></tt>, runs recursively on each child node and concatenates the results.</li>
<li>Otherwise returns an empty string.</li>
</ul>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#text,XmlNode">text proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;my text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newComment</span><span class="Punctuation">(</span><span class="StringLit">&quot;my comment&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;my entity&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;myTag&gt;my text&lt;!-- my comment --&gt;&amp;my entity;&lt;/myTag&gt;&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">innerText</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;my textmy entity&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L276" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L276" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="insert-procs-all">
<div id="insert,XmlNode,XmlNode,int">
<dt><pre><span class="Keyword">proc</span> <a href="#insert%2CXmlNode%2CXmlNode%2Cint"><span class="Identifier">insert</span></a><span class="Other">(</span><span class="Identifier">father</span><span class="Other">,</span> <span class="Identifier">son</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">index</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Inserts the child <tt class="docutils literal"><span class="pre"><span class="Identifier">son</span></span></tt> to a given position in <tt class="docutils literal"><span class="pre"><span class="Identifier">father</span></span></tt>.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">father</span></span></tt> must be of <tt class="docutils literal"><span class="pre"><span class="Identifier">xnElement</span></span></tt> kind.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#insert,XmlNode,openArray[XmlNode],int">insert proc</a></li>
<li><a class="reference external" href="#add,XmlNode,XmlNode">add proc</a></li>
<li><a class="reference external" href="#add,XmlNode,openArray[XmlNode]">add proc</a></li>
<li><a class="reference external" href="#delete,XmlNode,Natural">delete proc</a></li>
<li><a class="reference external" href="#delete.XmlNode,Slice[int]">delete proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,int,openArray[XmlNode]">replace proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,Slice[int],openArray[XmlNode]">replace proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;first&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;second&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;myTag&gt;
&lt;second /&gt;
&lt;first /&gt;
&lt;/myTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L350" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L350" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="insert,XmlNode,openArray[XmlNode],int">
<dt><pre><span class="Keyword">proc</span> <a href="#insert%2CXmlNode%2CopenArray%5BXmlNode%5D%2Cint"><span class="Identifier">insert</span></a><span class="Other">(</span><span class="Identifier">father</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">sons</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">index</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Inserts the children openArray<a class="reference internal" href="#`sons`">`sons`</a> to a given position in <tt class="docutils literal"><span class="pre"><span class="Identifier">father</span></span></tt>.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">father</span></span></tt> must be of <tt class="docutils literal"><span class="pre"><span class="Identifier">xnElement</span></span></tt> kind.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#insert,XmlNode,XmlNode,int">insert proc</a></li>
<li><a class="reference external" href="#add,XmlNode,XmlNode">add proc</a></li>
<li><a class="reference external" href="#add,XmlNode,openArray[XmlNode]">add proc</a></li>
<li><a class="reference external" href="#delete,XmlNode,Natural">delete proc</a></li>
<li><a class="reference external" href="#delete.XmlNode,Slice[int]">delete proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,int,openArray[XmlNode]">replace proc</a></li>
<li><a class="reference external" href="#replace.XmlNode,Slice[int],openArray[XmlNode]">replace proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;first&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;second&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;third&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;myTag&gt;
&lt;second /&gt;
&lt;third /&gt;
&lt;first /&gt;
&lt;/myTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L378" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L378" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="kind-procs-all">
<div id="kind,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#kind%2CXmlNode"><span class="Identifier">kind</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNodeKind"><span class="Identifier">XmlNodeKind</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>'s kind.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;firstTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">kind</span> <span class="Operator">==</span> <span class="Identifier">xnElement</span>
<span class="Keyword">var</span> <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;my text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">b</span><span class="Operator">.</span><span class="Identifier">kind</span> <span class="Operator">==</span> <span class="Identifier">xnText</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L519" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L519" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-procs-all">
<div id="len,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CXmlNode"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the number of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>'s children.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;first&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;second&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L509" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L509" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newCData-procs-all">
<div id="newCData,sinkstring">
<dt><pre><span class="Keyword">proc</span> <a href="#newCData%2Csinkstring"><span class="Identifier">newCData</span></a><span class="Other">(</span><span class="Identifier">cdata</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a new <tt class="docutils literal"><span class="pre">XmlNode</span></tt> of kind <tt class="docutils literal"><span class="pre">xnCData</span></tt> with the text <tt class="docutils literal"><span class="pre"><span class="Identifier">cdata</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">d</span> <span class="Operator">=</span> <span class="Identifier">newCData</span><span class="Punctuation">(</span><span class="StringLit">&quot;my cdata&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">d</span><span class="Operator">.</span><span class="Identifier">kind</span> <span class="Operator">==</span> <span class="Identifier">xnCData</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">d</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;![CDATA[my cdata]]&gt;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L130" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L130" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newComment-procs-all">
<div id="newComment,sinkstring">
<dt><pre><span class="Keyword">proc</span> <a href="#newComment%2Csinkstring"><span class="Identifier">newComment</span></a><span class="Other">(</span><span class="Identifier">comment</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a new <tt class="docutils literal"><span class="pre">XmlNode</span></tt> of kind <tt class="docutils literal"><span class="pre">xnComment</span></tt> with the text <tt class="docutils literal"><span class="pre"><span class="Identifier">comment</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">newComment</span><span class="Punctuation">(</span><span class="StringLit">&quot;my comment&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">kind</span> <span class="Operator">==</span> <span class="Identifier">xnComment</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">c</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;!-- my comment --&gt;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L120" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L120" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newElement-procs-all">
<div id="newElement,sinkstring">
<dt><pre><span class="Keyword">proc</span> <a href="#newElement%2Csinkstring"><span class="Identifier">newElement</span></a><span class="Other">(</span><span class="Identifier">tag</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Creates a new <tt class="docutils literal"><span class="pre">XmlNode</span></tt> of kind <tt class="docutils literal"><span class="pre">xnElement</span></tt> with the given <tt class="docutils literal"><span class="pre"><span class="Identifier">tag</span></span></tt>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#newXmlTree,string,openArray[XmlNode],XmlAttributes">newXmlTree proc</a></li>
<li><a class="reference external" href="#&lt;&gt;.m,untyped">&lt;&gt; macro</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;firstTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;childTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">kind</span> <span class="Operator">==</span> <span class="Identifier">xnElement</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">a</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;firstTag&gt;
&lt;childTag /&gt;
&lt;/firstTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L85" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L85" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newEntity-procs-all">
<div id="newEntity,string">
<dt><pre><span class="Keyword">proc</span> <a href="#newEntity%2Cstring"><span class="Identifier">newEntity</span></a><span class="Other">(</span><span class="Identifier">entity</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a new <tt class="docutils literal"><span class="pre">XmlNode</span></tt> of kind <tt class="docutils literal"><span class="pre">xnEntity</span></tt> with the text <tt class="docutils literal"><span class="pre"><span class="Identifier">entity</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">e</span> <span class="Operator">=</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;my entity&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">kind</span> <span class="Operator">==</span> <span class="Identifier">xnEntity</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">e</span> <span class="Operator">==</span> <span class="StringLit">&quot;&amp;my entity;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L140" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L140" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newText-procs-all">
<div id="newText,sinkstring">
<dt><pre><span class="Keyword">proc</span> <a href="#newText%2Csinkstring"><span class="Identifier">newText</span></a><span class="Other">(</span><span class="Identifier">text</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a new <tt class="docutils literal"><span class="pre">XmlNode</span></tt> of kind <tt class="docutils literal"><span class="pre">xnText</span></tt> with the text <tt class="docutils literal"><span class="pre"><span class="Identifier">text</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;my text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">b</span><span class="Operator">.</span><span class="Identifier">kind</span> <span class="Operator">==</span> <span class="Identifier">xnText</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">b</span> <span class="Operator">==</span> <span class="StringLit">&quot;my text&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L104" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L104" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newVerbatimText-procs-all">
<div id="newVerbatimText,sinkstring">
<dt><pre><span class="Keyword">proc</span> <a href="#newVerbatimText%2Csinkstring"><span class="Identifier">newVerbatimText</span></a><span class="Other">(</span><span class="Identifier">text</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a new <tt class="docutils literal"><span class="pre">XmlNode</span></tt> of kind <tt class="docutils literal"><span class="pre">xnVerbatimText</span></tt> with the text <tt class="docutils literal"><span class="pre"><span class="Identifier">text</span></span></tt>. <strong>Since</strong>: Version 1.3.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L114" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L114" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newXmlTree-procs-all">
<div id="newXmlTree,sinkstring,openArray[XmlNode],XmlAttributes">
<dt><pre><span class="Keyword">proc</span> <a href="#newXmlTree%2Csinkstring%2CopenArray%5BXmlNode%5D%2CXmlAttributes"><span class="Identifier">newXmlTree</span></a><span class="Other">(</span><span class="Identifier">tag</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">children</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">attributes</span><span class="Other">:</span> <a href="xmltree.html#XmlAttributes"><span class="Identifier">XmlAttributes</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Creates a new XML tree with <tt class="docutils literal"><span class="pre"><span class="Identifier">tag</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">children</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">attributes</span></span></tt>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#newElement,string">newElement proc</a></li>
<li><a class="reference external" href="#&lt;&gt;.m,untyped">&lt;&gt; macro</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">g</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;some text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newComment</span><span class="Punctuation">(</span><span class="StringLit">&quot;this is comment&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">var</span> <span class="Identifier">h</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;secondTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">h</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;some entity&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">att</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;first value&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;second value&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">toXmlAttributes</span>
<span class="Keyword">let</span> <span class="Identifier">k</span> <span class="Operator">=</span> <span class="Identifier">newXmlTree</span><span class="Punctuation">(</span><span class="StringLit">&quot;treeTag&quot;</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="Identifier">g</span><span class="Punctuation">,</span> <span class="Identifier">h</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">att</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Operator">$</span><span class="Identifier">k</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;treeTag key1=&quot;first value&quot; key2=&quot;second value&quot;&gt;
&lt;myTag&gt;some text&lt;!-- this is comment --&gt;&lt;/myTag&gt;
&lt;secondTag&gt;&amp;some entity;&lt;/secondTag&gt;
&lt;/treeTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L150" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L150" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="rawTag-procs-all">
<div id="rawTag,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#rawTag%2CXmlNode"><span class="Identifier">rawTag</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the underlying 'tag' string by reference.</p>
<p>This is only used for speed hacks.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L267" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L267" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="rawText-procs-all">
<div id="rawText,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#rawText%2CXmlNode"><span class="Identifier">rawText</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the underlying 'text' string by reference.</p>
<p>This is only used for speed hacks.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L258" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L258" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="replace-procs-all">
<div id="replace,XmlNode,Natural,openArray[XmlNode]">
<dt><pre><span class="Keyword">proc</span> <a href="#replace%2CXmlNode%2CNatural%2CopenArray%5BXmlNode%5D"><span class="Identifier">replace</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#Natural"><span class="Identifier">Natural</span></a><span class="Other">;</span> <span class="Identifier">replacement</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Replaces the <tt class="docutils literal"><span class="pre"><span class="Identifier">i</span></span></tt>'th child of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> with <tt class="docutils literal"><span class="pre"><span class="Identifier">replacement</span></span></tt> openArray.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> must be of <tt class="docutils literal"><span class="pre"><span class="Identifier">xnElement</span></span></tt> kind.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#replace.XmlNode,Slice[int],openArray[XmlNode]">replace proc</a></li>
<li><a class="reference external" href="#add,XmlNode,XmlNode">add proc</a></li>
<li><a class="reference external" href="#add,XmlNode,openArray[XmlNode]">add proc</a></li>
<li><a class="reference external" href="#delete,XmlNode,Natural">delete proc</a></li>
<li><a class="reference external" href="#delete.XmlNode,Slice[int]">delete proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,XmlNode,int">insert proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,openArray[XmlNode],int">insert proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;first&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;second&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">replace</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;third&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;fourth&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;myTag&gt;
&lt;third /&gt;
&lt;fourth /&gt;
&lt;first /&gt;
&lt;/myTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L453" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L453" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="replace,XmlNode,Slice[int],openArray[XmlNode]">
<dt><pre><span class="Keyword">proc</span> <a href="#replace%2CXmlNode%2CSlice%5Bint%5D%2CopenArray%5BXmlNode%5D"><span class="Identifier">replace</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">replacement</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Deletes the items <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span><span class="Punctuation">[</span><span class="Identifier">slice</span><span class="Punctuation">]</span></span></tt> of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> must be of <tt class="docutils literal"><span class="pre"><span class="Identifier">xnElement</span></span></tt> kind.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#replace.XmlNode,int,openArray[XmlNode]">replace proc</a></li>
<li><a class="reference external" href="#add,XmlNode,XmlNode">add proc</a></li>
<li><a class="reference external" href="#add,XmlNode,openArray[XmlNode]">add proc</a></li>
<li><a class="reference external" href="#delete,XmlNode,Natural">delete proc</a></li>
<li><a class="reference external" href="#delete.XmlNode,Slice[int]">delete proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,XmlNode,int">insert proc</a></li>
<li><a class="reference external" href="#insert,XmlNode,openArray[XmlNode],int">insert proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;first&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;second&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;fifth&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">f</span><span class="Operator">.</span><span class="Identifier">replace</span><span class="Punctuation">(</span><span class="FloatNumber">0.</span><span class="Operator">.</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;third&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;fourth&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">f</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;myTag&gt;
&lt;third /&gt;
&lt;fourth /&gt;
&lt;first /&gt;
&lt;/myTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L481" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L481" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="tag-procs-all">
<div id="tag,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#tag%2CXmlNode"><span class="Identifier">tag</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#lent"><span class="Identifier">lent</span></a> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Gets the tag name of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> has to be an <tt class="docutils literal"><span class="pre">xnElement</span></tt> node.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#text,XmlNode">text proc</a> for text getter</li>
<li><a class="reference external" href="#text=,XmlNode,string">text= proc</a> for text setter</li>
<li><a class="reference external" href="#tag=,XmlNode,string">tag= proc</a> for tag setter</li>
<li><a class="reference external" href="#innerText,XmlNode">innerText proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;firstTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;childTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">a</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;firstTag&gt;
&lt;childTag /&gt;
&lt;/firstTag&gt;&quot;&quot;&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">tag</span> <span class="Operator">==</span> <span class="StringLit">&quot;firstTag&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L214" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L214" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="tag=-procs-all">
<div id="tag=,XmlNode,sinkstring">
<dt><pre><span class="Keyword">proc</span> <a href="#tag%3D%2CXmlNode%2Csinkstring"><span class="Identifier">tag=</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">tag</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Sets the tag name of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> has to be an <tt class="docutils literal"><span class="pre">xnElement</span></tt> node.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#text,XmlNode">text proc</a> for text getter</li>
<li><a class="reference external" href="#text=,XmlNode,string">text= proc</a> for text setter</li>
<li><a class="reference external" href="#tag,XmlNode">tag proc</a> for tag getter</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;firstTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;childTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">a</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;firstTag&gt;
&lt;childTag /&gt;
&lt;/firstTag&gt;&quot;&quot;&quot;</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">tag</span> <span class="Operator">=</span> <span class="StringLit">&quot;newTag&quot;</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">a</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;newTag&gt;
&lt;childTag /&gt;
&lt;/newTag&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L235" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L235" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="text-procs-all">
<div id="text,XmlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#text%2CXmlNode"><span class="Identifier">text</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#lent"><span class="Identifier">lent</span></a> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Gets the associated text with the node <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> can be a CDATA, Text, comment, or entity node.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#text=,XmlNode,string">text= proc</a> for text setter</li>
<li><a class="reference external" href="#tag,XmlNode">tag proc</a> for tag getter</li>
<li><a class="reference external" href="#tag=,XmlNode,string">tag= proc</a> for tag setter</li>
<li><a class="reference external" href="#innerText,XmlNode">innerText proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">newComment</span><span class="Punctuation">(</span><span class="StringLit">&quot;my comment&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">c</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;!-- my comment --&gt;&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">text</span> <span class="Operator">==</span> <span class="StringLit">&quot;my comment&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L178" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L178" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="text=-procs-all">
<div id="text=,XmlNode,sinkstring">
<dt><pre><span class="Keyword">proc</span> <a href="#text%3D%2CXmlNode%2Csinkstring"><span class="Identifier">text=</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">;</span> <span class="Identifier">text</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Sets the associated text with the node <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> can be a CDATA, Text, comment, or entity node.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#text,XmlNode">text proc</a> for text getter</li>
<li><a class="reference external" href="#tag,XmlNode">tag proc</a> for tag getter</li>
<li><a class="reference external" href="#tag=,XmlNode,string">tag= proc</a> for tag setter</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">e</span> <span class="Operator">=</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;my entity&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">e</span> <span class="Operator">==</span> <span class="StringLit">&quot;&amp;my entity;&quot;</span>
<span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">text</span> <span class="Operator">=</span> <span class="StringLit">&quot;a new entity text&quot;</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">e</span> <span class="Operator">==</span> <span class="StringLit">&quot;&amp;a new entity text;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L196" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L196" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toXmlAttributes-procs-all">
<div id="toXmlAttributes,varargs[tuple[string,string]]">
<dt><pre><span class="Keyword">proc</span> <a href="#toXmlAttributes%2Cvarargs%5Btuple%5Bstring%2Cstring%5D%5D"><span class="Identifier">toXmlAttributes</span></a><span class="Other">(</span><span class="Identifier">keyValuePairs</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">key</span><span class="Other">,</span> <span class="Identifier">val</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlAttributes"><span class="Identifier">XmlAttributes</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Converts <tt class="docutils literal"><span class="pre"><span class="Punctuation">{</span><span class="Identifier">key</span><span class="Punctuation">:</span> <span class="Identifier">value</span><span class="Punctuation">}</span></span></tt> pairs into <tt class="docutils literal"><span class="pre"><span class="Identifier">XmlAttributes</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">att</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;first value&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;second value&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">toXmlAttributes</span>
<span class="Keyword">var</span> <span class="Identifier">j</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">j</span><span class="Operator">.</span><span class="Identifier">attrs</span> <span class="Operator">=</span> <span class="Identifier">att</span>
<span class="Identifier">doAssert</span> <span class="Operator">$</span><span class="Identifier">j</span> <span class="Operator">==</span> <span class="LongStringLit">&quot;&quot;&quot;&lt;myTag key1=&quot;first value&quot; key2=&quot;second value&quot; /&gt;&quot;&quot;&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L602" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L602" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="items-iterators-all">
<div id="items.i,XmlNode">
<dt><pre><span class="Keyword">iterator</span> <a href="#items.i%2CXmlNode"><span class="Identifier">items</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Iterates over all direct children of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">g</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;myTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;some text&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newComment</span><span class="Punctuation">(</span><span class="StringLit">&quot;this is comment&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">var</span> <span class="Identifier">h</span> <span class="Operator">=</span> <span class="Identifier">newElement</span><span class="Punctuation">(</span><span class="StringLit">&quot;secondTag&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">h</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;some entity&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">g</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">h</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">g</span> <span class="Operator">==</span> <span class="StringLit">&quot;&lt;myTag&gt;some text&lt;!-- this is comment --&gt;&lt;secondTag&gt;&amp;some entity;&lt;/secondTag&gt;&lt;/myTag&gt;&quot;</span>
<span class="Comment"># for x in g: # the same as `for x in items(g):`</span>
<span class="Comment"># echo x</span>
<span class="Comment"># some text</span>
<span class="Comment"># &lt;!-- this is comment --&gt;</span>
<span class="Comment"># &lt;secondTag&gt;&amp;some entity;&lt;![CDATA[some cdata]]&gt;&lt;/secondTag&gt;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L573" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L573" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="mitems-iterators-all">
<div id="mitems.i,XmlNode">
<dt><pre><span class="Keyword">iterator</span> <a href="#mitems.i%2CXmlNode"><span class="Identifier">mitems</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="xmltree.html#XmlNode"><span class="Identifier">XmlNode</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Iterates over all direct children of <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> so that they can be modified.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L597" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L597" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="17">
<h1><a class="toc-backref" href="#17">Macros</a></h1>
<dl class="item">
<div id="&lt;&gt;-macros-all">
<div id="<>.m,untyped">
<dt><pre><span class="Keyword">macro</span> <a href="#%3C%3E.m%2Cuntyped"><span class="Identifier">`&lt;&gt;`</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
<dd>
<p>Constructor macro for XML. Example usage:</p>
<p><pre class="listing"><span class="Operator">&lt;&gt;</span><span class="Identifier">a</span><span class="Punctuation">(</span><span class="Identifier">href</span><span class="Operator">=</span><span class="StringLit">&quot;https://nim-lang.org&quot;</span><span class="Punctuation">,</span> <span class="Identifier">newText</span><span class="Punctuation">(</span><span class="StringLit">&quot;Nim rules.&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre></p>
<p>Produces an XML tree for:</p>
<pre>&lt;a href=&quot;https://nim-lang.org&quot;&gt;Nim rules.&lt;/a&gt;</pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/xmltree.nim#L938" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/xmltree.nim#L938" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-09-27 04:01:54 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>