DOM question

Paul Prescod paulp at ActiveState.com
Mon May 14 20:42:53 EDT 2001


Timothy Grant wrote:
> 
> Forgive my XML newbieness, but I'm puzzled by something.
> 
> I have been able to use minidom to read a tree and walk the
> nodes and such, but I can't figure out how to access the
> textual data in a tag. Given the following:
> 
> <tag attribute='test'>This is the text I want</tag>
> 
> I can find the  tag, I can read the attribute, but what minidom
> or dom functions return the contents of the text?

The contents are a node of their own. Get it as the first child node of
the element. It will be a text node with a nodeValue.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list