Greetings, Monks,
I am using XML::LibXML to delete all the child nodes of a certain type below the parent node while retaining the other child nodes, apart from empty text nodes. For reasons unknown to me, all the information stored is as attributes and the text nodes are all always empty.
The problem is that for each deleted node, a text node is left behind. So if I start with:
<table> <header colname1="monk" colname2="favourite syllable"> <row monk="mainmonk" syllable="om"/> <row monk="loris" syllable="erm"/> </table>
and remove all the rows with
my @rowNodes = $parent->findnodes("row"); foreach my $rowNode (@rowNodes) { $parent->removeChild($rowNode); }
I end up with
<table> <header colname1="monk" colname2="favourite syllable"> </table>
rather than
<table> <header colname1="monk" colname2="favourite syllable"> </table>
Can anyone tell me how to remove the empty text nodes corresponding to the row nodes?
Thanks,
loris
In reply to XML::LibXML - Removing text nodes by loris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |