in reply to Using XML::DOM to get the contents of an element
I think that the error you were getting was from the first iteration of the loop, in my case $node was an XML::DOM::DocumentType object and not an XML::DOM::Element object. Also, since you only need the first child, i believe you can use getFirstChild() instead of having to explicitly query an array index. Ughhh, i think i will take mirod's advice and avoid the DOM. ;)foreach my $node ($doc->getChildNodes()) { next unless $node->getNodeType == ELEMENT_NODE; my $child_node = $node->getFirstChild(); my $content = $child_node->getData(); print $content,$/; }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|