diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb index 558b5d731a..2b6ee24087 100644 --- a/lib/rexml/document.rb +++ b/lib/rexml/document.rb @@ -66,6 +66,7 @@ module REXML def add( child ) if child.kind_of? XMLDecl @children.unshift child + child.parent = self elsif child.kind_of? DocType # Find first Element or DocType node and insert the decl right # before it. If there is no such node, just insert the child at the