BuZZ-dEE
BuZZ-dEE

Reputation: 6949

How to set text into a DOM element

I'm trying to set text into a DOM element. I create the element.

svg_doc = minidom.parse('PATH_TO_SVG_FILE.svg')
category = svg_doc.createElement('category')

Then I try to set the nodeValue:

category.nodeValue = 'Design'

But I get:

<category/>

instead of:

<category>Design<category/>

How to get the desired result with minidom?

Upvotes: 0

Views: 1176

Answers (1)

user3053389
user3053389

Reputation: 26

I think this should work:

category.createTextNode('Design')

See: https://docs.python.org/2/library/xml.dom.minidom.html

Upvotes: 1

Related Questions