# \[Bug #3551\] REXML::Document#add uses undefined method 'kind\_of'

**URL:** <https://www.ruby-forum.com/t/bug-3551-rexml-document-add-uses-undefined-method-kind-of/191281>\
**Category:** Development\
**Created:** [July 8, 2010, 7:24pm UTC](https://www.ruby-forum.com/t/bug-3551-rexml-document-add-uses-undefined-method-kind-of/191281 "2010-07-08T19:24:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![asarih](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9de053/32.png) [@asarih](https://www.ruby-forum.com/u/asarih)\
**Post date:** [July 8, 2010, 7:24pm UTC](https://www.ruby-forum.com/t/bug-3551-rexml-document-add-uses-undefined-method-kind-of/191281/1 "2010-07-08T19:24:02Z")

</div>

Bug #3551: REXML::Document#add uses undefined method ‘kind\_of’  
[http://redmine.ruby-lang.org/issues/show/3551](http://redmine.ruby-lang.org/issues/show/3551)

e$B5/I\<\<Te(B: Hiro A.  
e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Low  
e$B%+%F%4%je(B: lib  
ruby -v: ruby 1.8.8dev (2010-07-08) [i386-darwin10.4.0]

e$BL@$i$+$Ke(B kind\_of? e$B$N4V0c$$$G$9!#e(B1.9e$B$G$OD\>$C$F$$$^$9!#e(B

# $ svn diff Index: lib/rexml/document.rb

— lib/rexml/document.rb (revision 28587)  
+++ lib/rexml/document.rb (working copy)  
@@ -78,7 +78,7 @@  
x.kind\_of?(Element) || x.kind\_of?(DocType)  
}  
if @children[insert\_before\_index] # Not null = not end of  
list

- 

```
     if @children[insert_before_index].kind_of DocType

```

- 

```
     if @children[insert_before_index].kind_of? DocType
       @children[insert_before_index] = child
     else
       @children[index_before_index-1, 0] = child

```

---

<div class="post-metadata">

**Author:** ![asarih](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9de053/32.png) [@asarih](https://www.ruby-forum.com/u/asarih)\
**Post date:** [July 8, 2010, 7:50pm UTC](https://www.ruby-forum.com/t/bug-3551-rexml-document-add-uses-undefined-method-kind-of/191281/2 "2010-07-08T19:50:24Z")

</div>

e$B%A%1%C%He(B #3551 e$B$,99?7$5$l$^$7$?!#e(B (by Nobuyoshi N.)

## r26513

[http://redmine.ruby-lang.org/issues/show/3551](http://redmine.ruby-lang.org/issues/show/3551)
