minidom get Element value

S

Scott F

Hi all,

Today's embarassingly simple question goes like this.

I have a file, testdoc.xml, to parse.
Inside the file is an element

<refrain>Yo, Ho, Ho</refrain>

So, starting with

Code:
from xml.dom import minidom
xmldoc = minidom.parse('home\me\testdoc.xml')

therefrain = getTagsByName('refrain')
print therefrain.toxml()

does print the whole Element

What code do I need to merely print the *value* of the element, i.e.,
I would like to see

Yo, Ho, Ho

printed out.

I can get Attribute values, the whole Element with tags, etc., and
could do a substring search on the Element, but surely something
exists within minidom to do this.

Thanks.

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,222
Messages
2,571,142
Members
47,757
Latest member
PDIJaclyn

Latest Threads

Top