diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rexml/xpath_parser.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb index f663215b07..a94ad91ea1 100644 --- a/lib/rexml/xpath_parser.rb +++ b/lib/rexml/xpath_parser.rb @@ -212,7 +212,19 @@ module REXML nodeset.each do |node| nt = node.node_type # trace(:child, nt, node) - new_nodeset += node.children if nt == :element or nt == :document + case nt + when :element + new_nodeset.concat(node.children) + when :document + node.children.each do |child| + case child + when XMLDecl, Text + # ignore + else + new_nodeset << child + end + end + end end nodeset = new_nodeset node_types = ELEMENTS |