Extracting text from XML node with minidom

miri123

New Member
I've looked through several posts but I haven't quite found any answers that have solved my problem.Sample XML = \[code\]<TextWithNodes><Node id="0"/>TEXT1<Node id="19"/>TEXT2 <Node id="20"/>TEXT3<Node id="212"/></TextWithNodes>\[/code\]So I understand that usually if I had extracted \[code\]TextWithNodes\[/code\] as a \[code\]NodeList\[/code\] I would do something like\[code\]nodeList = TextWithNodes[0].getElementsByTagName('Node')for a in nodeList: node = a.nodeValue print node\[/code\]All I get is \[code\]None\[/code\]. I've read that you must write \[code\]a.childNodes.nodeValue\[/code\] but there isn't a child node to the node list since it looks like all the \[code\]Node\[/code\] Ids are closing tags? If I use \[code\]a.childNodes\[/code\] I get \[code\][]\[/code\].When I get the node type for \[code\]a\[/code\] it is type 1 and \[code\]TEXT_NODE\[/code\] = 3. I'm not sure if that is helpful. I would like to extract \[code\]TEXT1\[/code\], \[code\]TEXT2\[/code\], etc.
 
Back
Top