minidom Node to Element
Richard Lewis
richardlewis at fastmail.co.uk
Fri Jun 3 12:13:16 EDT 2005
Hang on!
It *knows*! Wow, you can call getElementsByTagName() on a Node object
and it does the right thing.
Weird, but I like it! Very Python!
R.
On Fri, 03 Jun 2005 17:07:37 +0100, "Richard Lewis"
<richardlewis at fastmail.co.uk> said:
> Hey,
>
> Can I convert an xml.dom.Node object to an xml.dom.Element object? I
> want to do the conversion inside a condition like this:
>
> if node.nodeType == Node.ELEMENT_NODE:
> # do conversion:
> element = Element(node)
> element = node.toElement()
>
> so it definitely won't cause problems. I just can't find a way to do it!
>
> (I want to be able to call getElementsByTagName() on the resultant
> object; any other workarounds which allow the same functionality would
> be just as cool ;-)
>
> Cheers,
> Richard
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list