Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

How to remove empty XML elements using XML::LibXML

by FreakyGreenLeaky (Sexton)
on Feb 17, 2013 at 19:22 UTC ( #1019196=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    <?xml version="1.0" encoding="UTF-8"?>
    <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.o
    +rg/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:n
    +s:epp-1.0 epp-1.0.xsd">
  2. or download this
    for my $remove ($frame->findnodes(q{/command/update/contact:update/con
    +tact:add})) {
  3. or download this
    XPath error : Undefined namespace prefix
     error : xmlXPathCompiledEval: evaluation failed
  4. or download this
    sub new {
        my $package = shift;
        return $self;
  5. or download this
    my $p = $frame->getElementsByTagName('contact:update');
        foreach my $n ($p->[0]->childNodes()) {
            $p->[0]->removeChild($n) if $n->toString(1) eq "<contact:add/>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1019196]
Front-paged by Corion
[davido]: jdporter : Is there a specific issue, or are we all just getting up there?
thezip vouches for that, but then forgets what he was vouching for...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2018-06-21 16:40 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.