# Hpricot inner\_html

**URL:** <https://www.ruby-forum.com/t/hpricot-inner-html/186509>\
**Category:** Ruby\
**Created:** [April 8, 2010, 4:21am UTC](https://www.ruby-forum.com/t/hpricot-inner-html/186509 "2010-04-08T04:21:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharnel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@sharnel](https://www.ruby-forum.com/u/sharnel)\
**Post date:** [April 8, 2010, 4:21am UTC](https://www.ruby-forum.com/t/hpricot-inner-html/186509/1 "2010-04-08T04:21:24Z")

</div>

Have the below xml

test test1 testdata 21546

i need to get data in MetaString tag to be displayed

doc2 = Hpricot(xml2)  
doc2.search("/metas").each do |meta|  
meta.search(’/Meta’).each do |metastring|  
print("\n"+(metastring.at("/MetaString").inner\_html))  
end  
end

i get the below error nessage

NoMethodError (undefined method `inner\_html’ for nil:NilClass

Kindly help

---

<div class="post-metadata">

**Author:** ![sharnel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@sharnel](https://www.ruby-forum.com/u/sharnel)\
**Post date:** [April 8, 2010, 7:11am UTC](https://www.ruby-forum.com/t/hpricot-inner-html/186509/2 "2010-04-08T07:11:00Z")

</div>

if I give (doc2/‘metas’).inner\_html

testtest1testdata21546

I am not able to understand why the tag gets closed before  
enclosing as in the xml

i expeced the result as test

Kindly help
