How to set text into a DOM element
<p>I'm trying to set text into a DOM element. I create the element.</p>

<pre><code>svg_doc = minidom.parse('PATH_TO_SVG_FILE.svg')
category = svg_doc.createElement('category')
</code></pre>

<p>Then I try to set the <code>nodeValue</code>:</p>

<pre><code>category.nodeValue = 'Design'
</code></pre>

<p>But I get:</p>

<pre><code>&lt;category/&gt;
</code></pre>

<p>instead of:</p>

<pre><code>&lt;category&gt;Design&lt;category/&gt;
</code></pre>

<p>How to get the desired result with minidom?</p>

<p>I think this should work:</p>

<pre><code>category.createTextNode('Design')
</code></pre>

<p>See: <a href="https://docs.python.org/2/library/xml.dom.minidom.html" rel="nofollow">https://docs.python.org/2/library/xml.dom.minidom.html</a></p>

python xml dom svg minidom