# Xml-mapping lib question?

**URL:** <https://www.ruby-forum.com/t/xml-mapping-lib-question/120661>\
**Category:** Ruby\
**Created:** [November 19, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/xml-mapping-lib-question/120661 "2007-11-19T16:51:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/a9adbd/32.png) [@zxem](https://www.ruby-forum.com/u/zxem)\
**Post date:** [November 19, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/xml-mapping-lib-question/120661/1 "2007-11-19T16:51:35Z")

</div>

Hi all,

I got a xml looking like this.

-0.015523356673284

I tried to create a ruby class for it which is used by xml-mapping  
library.

class VolPoint  
include XML::Mapping  
text\_node :Interp, “@Interp”, :default\_value=\>nil  
text\_node :Strike, “@Strike”, :default\_value=\>nil  
text\_node :OptionType, “@OptionType”, :default\_value=\>nil  
text\_node :VolValue, “text()”, :default\_value=\>nil # Does not work  
here  
end

But this class could not get the text from VolPoint element(last line  
of code). Could anyone tell me how to get the value out of the  
VolPoint?

Cheers!

---

<div class="post-metadata">

**Author:** ![zxem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/a9adbd/32.png) [@zxem](https://www.ruby-forum.com/u/zxem)\
**Post date:** [November 20, 2007, 5:21pm UTC](https://www.ruby-forum.com/t/xml-mapping-lib-question/120661/2 "2007-11-20T17:21:00Z")

</div>

On Nov 19, 3:49 pm, zxem [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> class VolPoint  
> VolPoint?
> 
> Cheers!

I found the solution, you should write the code like this:

class VolPoint  
includeXML::Mapping  
text\_node :Interp, “@Interp”, :default\_value=\>nil  
text\_node :Strike, “@Strike”, :default\_value=\>nil  
text\_node :OptionType, “@OptionType”, :default\_value=\>nil  
text\_node :VolValue, “”, :default\_value=\>nil  
end
