Commit 8fcc3eea authored by Jonathon Duerig's avatar Jonathon Duerig

Added a new function to allow removal of XML nodes by name. Fixed a related bug in the CM.

parent a30ffc59
......@@ -4010,11 +4010,11 @@ sub UpdateManifest($)
}
$vlantags{$vlan->vname()} = $tag;
}
foreach my $linkref (GeniXML::GetNodes("n:link", $rspec)) {
foreach my $linkref (GeniXML::GetNodes("n:link", $rspec)->get_nodelist()) {
my $vname = GeniXML::GetVirtualId($linkref);
my $tag = (exists($vlantags{$vname}) ? $vlantags{$vname} : undef);
if (!defined($tag)) {
$linkref->removeChild("vlantag");
GeniXML::RemoveChild("vlantag", $linkref);
}
else {
GeniXML::SetText("vlantag", $linkref, $tag);
......
......@@ -261,5 +261,17 @@ sub AddElement($$)
return $child;
}
sub RemoveChild($$)
{
my ($name, $node) = @_;
my $child = FindFirst('@n:'.$name, $node);
if (! defined($child)) {
$child = FindFirst('n:'.$name, $node);
}
if (defined($child)) {
$node->removeChild($child);
}
}
# _Always_ make sure that this 1 is at the end of the file...
1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment