|Just another Perl shrine|
Using XML::DOM to get the contents of an elementby ezekiel (Pilgrim)
|on Oct 02, 2002 at 03:57 UTC||Need Help??|
ezekiel has asked for the
wisdom of the Perl Monks concerning the following question:
I have this loop:
Each $node represents a piece of XML of the form: <tag_name>Content</tag_name>
I want to extract the "Content" ie the character data between the start and end tags of each node in the loop above. There is only character data in each of these nodes.
My understanding of the docs is that the character data is stored in the only child node of the node representing the element. Hence I tried to extract it with:
but this dies with the error "Can't call method "getData" on an undefined value"
I'm sure this is simple, but I'm having one of those days and I just can't spot the error. Any suggestions? Thanks