minidom and problem with getElementsByTagName()

Brian Quinlan brian at sweetapp.com
Fri May 3 17:37:48 EDT 2002


> I got 'first', 'a'. I wanted: 'first', 'second'. It seems to work as
> XPath for '//nr' but I want only 'nr'. It means, I want to get all
> nodes at the current level NOT to every descendants. :-(
> 
> Can I make minidom for getting childeren nodes without recursion? Do
> getElementsByTagName() method works always with recursion???

getElementsByTagName() is defined in the W3 DOM specification. Any
implementation that does not examine the entire tree is broken.

If you want to use minidom, use the other DOM functions to navigate the
document e.g. firstChild, childNodes, nodeName, etc.

Cheers,
Brian






More information about the Python-list mailing list