in reply to Re^2: how to remove an empty line from a xml file??
in thread how to remove an empty line from a xml file??

Much of Re^5: error : can't locate object method "getAttribute" via package XML::DOM::NodeList still applies, except now it's even code you've written yourself already, to remove a child node. Maybe add to that code more code to remove other child nodes.

  • Comment on Re^3: how to remove an empty line from a xml file??

Replies are listed 'Best First'.
Re^4: how to remove an empty line from a xml file??
by ankit.tayal560 (Beadle) on Oct 01, 2016 at 09:08 UTC

    hi corion, that empty line is another child of $Item element I understood that but it is a XML::DOM::TEXT element. I don't know how to remove text nodes? don't write any code for me (y) but could you please tell me how to do that

    to remove a node I do : $parent_name=removeChild($node_name)but to remove text node what should I write in place of $node_name

      In the code you already wrote yourself, you use the method ->removeChild. This method is just as applicable for text nodes as it is for other nodes. Maybe now is a really good moment to familiarize yourself with XML and the DOM?