DOM question

Timothy Grant tjg at hyperlinq.net
Mon May 14 20:50:42 EDT 2001


On Mon, May 14, 2001 at 05:42:53PM -0700, Paul Prescod wrote:
> 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.

Thanks Paul,

That answered my question. 

I've been trying to figure it out off and on for a couple of
days now. I tried both siblingNodes, but I didn't look at the
child nodes as I didn't think these nodes had any children.

<Shameless Suck Up>
I have the book you did on XML. Will we ever see a Python book
from you on XML? The only one I have found was Sean McGrath's
book, but it dealt strictly with Pyxie.
</Shameless Suck Up>

-- 
Stand Fast,
    tjg.

Timothy Grant                                www.hyperlinq.net 
Chief Technology Officer                     tjg at hyperlinq.net 
HyperLINq Technologies, Inc.                <>< (503) 246-3630
>>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
>>>>This machine was last rebooted:  48 days  3:00 hours ago<<




More information about the Python-list mailing list