I have a chunk of xml. I am using XML::LibXML to parse and mangle the data. If I unlink a node and then output the data to a file, the node is replaced by a blank line. Is there any way to change the behavior to not add the extranious whitespace?
Example:
Before xml removal: <item1/> <item2/> <item3/> After removing item2: <item1/> <item3/> Here is the sample code snippet (And yes, I pull the list using XML::S +imple.) my $manifesto = XMLin($google_manifest); foreach my $project (sort keys %{$manifesto->{'project'}}){ if ($project){ $project = 'a/aosp/' . $project; print "Project = $project \n"; my $query1 = '//project[@name = "' . $project . '"]'; my ($node) = $doc->findnodes($query1); if ($node){ $node->unbindNode(); } } } print $doc->toFile($new_manifest);
Ideas?
In reply to Removing whitespace from deleted items in XML::LibXML by alan_olsen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |