# REXML inconsistency in Element methods

**URL:** <https://www.ruby-forum.com/t/rexml-inconsistency-in-element-methods/63644>\
**Category:** Ruby\
**Created:** [June 16, 2006, 10:06pm UTC](https://www.ruby-forum.com/t/rexml-inconsistency-in-element-methods/63644 "2006-06-16T22:06:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [June 16, 2006, 10:06pm UTC](https://www.ruby-forum.com/t/rexml-inconsistency-in-element-methods/63644/1 "2006-06-16T22:06:15Z")

</div>

value() is defined on Elements of type  
:attribute and :text, but not :comment.  
For :comment, you use to\_s.

(to\_s may work for others, as well.  
Haven’t tried.)

Element  
.node\_type --returns a symbol  
:attribute – use node.value to get text  
:comment – use node.to\_s to get text  
:text – use node.value to get text

```
     :cdata (maybe. not verified)
     :element -- ...
```
