Note that there are some explanatory texts on larger screens.

plurals
  1. POPython minidom element.data only returns object, not text
    primarykey
    data
    text
    <p>I am fairly new to Python and am just trying to parse the results of a simple Web-API that returns the following XML-Syntax: </p> <pre><code>&lt;rss version='2.0'&gt; &lt;channel&gt; &lt;title&gt;www.onlinetvrecorder.com&lt;/title&gt; &lt;description&gt;OTR Torrents&lt;/description&gt; &lt;link&gt;http://www.onlinetvrecorder.com/&lt;/link&gt; &lt;copyright&gt;OTR&lt;/copyright&gt; &lt;STATIONS&gt; &lt;ITEM&gt; &lt;TITLE&gt;3SAT&lt;/TITLE&gt; &lt;COUNTRY&gt;DE&lt;/COUNTRY&gt; &lt;LANGUAGE&gt;DE&lt;/LANGUAGE&gt; &lt;/ITEM&gt; &lt;ITEM&gt; &lt;TITLE&gt;ANIXE&lt;/TITLE&gt; &lt;COUNTRY&gt;DE&lt;/COUNTRY&gt; &lt;LANGUAGE&gt;DE&lt;/LANGUAGE&gt; &lt;/ITEM&gt; &lt;ITEM&gt; &lt;TITLE&gt;ARD&lt;/TITLE&gt; &lt;COUNTRY&gt;DE&lt;/COUNTRY&gt; &lt;LANGUAGE&gt;DE&lt;/LANGUAGE&gt; &lt;/ITEM&gt; &lt;/STATIONS&gt; &lt;/channel&gt; &lt;/rss&gt; </code></pre> <p>My parser looks like that:</p> <pre><code>import xml.dom.minidom as dom def parseStations(stationsResult): document = dom.parse(stationsResult) stations = [] #get all ITEM elements and get their child TITLE items = document.getElementsByTagName("ITEM") for item in items: stationTitleNodeValue = item.getElementsByTagName("TITLE")[0].firstChild.data stations.append(stationTitleNodeValue); return stations </code></pre> <p>My intent is to get the text-value of the TITLE Elements in the xml. But when printing the contents of the return list to console, it looks like this:</p> <pre><code>&lt;DOM Element: TITLE at 0x368e8c0&gt; </code></pre> <p>What am I doing wrong? Can anybody of you help me? Thank you (VERY MUCH!) in advance,</p> <p>Christian</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload