msivask has asked for the wisdom of the Perl Monks concerning the following question:
Hi ,
Below is my requirement
I have an XML like
<sys xmlns="urn:mavenir:ns:yang:wrg-sc:6.0.2.8"> <platform><contact> <name>Mavenir</name> <phone>214-616-3499</phone> </contact> <solution> <name>mOne</name> <fkcontact>Mavenir</fkcontact> </solution> <tmmTableFilenameMap> <fileName>ALARM</fileName> <tableId>1</tableId> </tmmTableFilenameMap> <tmmTableFilenameMap> <fileName>AVGOVLDPERF</fileName> <tableId>7</tableId> </tmmTableFilenameMap> </platform> </sys>
I want to delete all nodes with tmmTableFilenameMap
I tried the below code
#!/usr/bin/perl use 5.010; use strict; use warnings; use XML::LibXML; my $filename = 'webrtcc_system_static_config_data_platremoved.xml'; my $a; my $dom = XML::LibXML->load_xml(location => $filename); my $book = $dom->documentElement; my $del="tmmTableFilenameMap"; my @a = $book->findnodes("tmmTableFilenameMap"); $book->removeChild($a); print $book->serialize();
It gives a strange error as below
XML::LibXML::Node::removeChild() -- node is not a blessed SV reference + at DeleteNodesXml.pl line 17.
Could some one help on this
2019-04-26 Athanasius added code and paragraph tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LibXML error when trying to delete a node in DOM
by hippo (Archbishop) on Apr 26, 2019 at 11:25 UTC | |
by bliako (Abbot) on Apr 26, 2019 at 13:53 UTC | |
|
Re: LibXML error when trying to delete a node in DOM
by choroba (Cardinal) on Apr 26, 2019 at 15:31 UTC | |
|
Re: LibXML error when trying to delete a node in DOM
by Jenda (Abbot) on May 02, 2019 at 17:19 UTC |