Bugs item #22415, was opened at 15/10/2008 09:52
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=22415&group_id=494

Category: General
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Elia Schito (elia)
Assigned to: Nobody (None)
Summary: xml_node.attributes.each { |a| a.remove! } # stops after removing the 
first attribute

Initial Comment:
# With the XML below the following won't work (will remove only the first 
attribute):

xml_object.find_first('ibbas:ncsa/ibbas:mcrange').attributes.each do 
|xml_attribute|
  xml_attribute.remove! if xml_attribute.name =~ /^(addr|range)\d+$/
end

# The following works:

attributes = []
xml_object.find_first('ibbas:ncsa/ibbas:mcrange').attributes.each{ |a| 
attributes << a }
attributes.each do |xml_attribute|
  xml_attribute.remove! if xml_attribute.name =~ /^(addr|range)\d+$/
end


__DATA__

<?xml version="1.0"?>
<ibbas:configuration xmlns:ibbas="http://www.gcs-salzburg.at/ibbas/0.3/";>
        <ibbas:ncsa active="1" nrchannels="1" autoreg="1" staticcfg="1" 
tsid="9200" dulmpid="0" timpid="2052" rcstblpid="2055" tbtppid="2056" 
dvbbase="10.0.0.1">
                <ibbas:mcrange addr1="224.1.1.1" range1="32" addr2="239.0.0.0" 
range2="8" addr3="224.20.20.1" range3="32"/>
        </ibbas:ncsa>
</ibbas:configuration>



----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=22415&group_id=494
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to